024dc095a5
T used to silently cycle Model.activeTeamID through the caller's teams with no visible list of choices. It now opens a full picker (modelled on the existing user picker) listing every team plus "All teams", each with a stable identity colour from a new six-colour theme palette. The same colour now also shows as a bullet next to "team: <name>" in the header, so the active team stays visible without opening the picker. Adds an Identity palette to the theme package (six hues, skipping the ones that already mean firing/critical), Styles.TeamColor to pick one by team id, and identity_1..6 as theme-file tokens alongside the existing twelve so a fully custom theme can still set every token.
100 lines
2.3 KiB
Go
100 lines
2.3 KiB
Go
package theme
|
|
|
|
import (
|
|
"sort"
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
)
|
|
|
|
// The gruvbox palettes, in the author's original names. Dark uses the bright
|
|
// variants and light the faded ones, which is what keeps each readable against
|
|
// its own background.
|
|
const (
|
|
darkBg0 = "#282828"
|
|
darkFg1 = "#ebdbb2"
|
|
darkGray = "#928374"
|
|
darkRed = "#fb4934"
|
|
darkGrn = "#b8bb26"
|
|
darkYel = "#fabd2f"
|
|
darkBlu = "#83a598"
|
|
darkAqua = "#8ec07c"
|
|
darkOrng = "#fe8019"
|
|
darkPurple = "#d3869b"
|
|
|
|
lightBg0 = "#fbf1c7"
|
|
lightFg1 = "#3c3836"
|
|
lightFg4 = "#7c6f64"
|
|
lightRed = "#9d0006"
|
|
lightGrn = "#79740e"
|
|
lightYel = "#b57614"
|
|
lightBlu = "#076678"
|
|
lightAqua = "#427b58"
|
|
lightOrng = "#af3a03"
|
|
lightPurple = "#8f3f71"
|
|
)
|
|
|
|
// GruvboxDark is the default scheme. It assumes a dark terminal background:
|
|
// themes colour foregrounds only, so the terminal supplies the canvas.
|
|
var GruvboxDark = Theme{
|
|
Name: "gruvbox-dark",
|
|
|
|
Primary: darkBlu,
|
|
OnPrimary: darkBg0,
|
|
Text: darkFg1,
|
|
Muted: darkGray,
|
|
Accent: darkOrng,
|
|
|
|
Firing: darkRed,
|
|
Resolved: darkGrn,
|
|
Error: darkRed,
|
|
|
|
SevCritical: darkRed,
|
|
SevError: darkOrng,
|
|
SevWarning: darkYel,
|
|
SevInfo: darkAqua,
|
|
|
|
// Red already means an alarm, so it is the one gruvbox hue left out here.
|
|
Identity: [6]lipgloss.Color{darkBlu, darkAqua, darkYel, darkGrn, darkOrng, darkPurple},
|
|
}
|
|
|
|
// GruvboxLight is the same scheme against a light terminal background.
|
|
var GruvboxLight = Theme{
|
|
Name: "gruvbox-light",
|
|
|
|
Primary: lightBlu,
|
|
OnPrimary: lightBg0,
|
|
Text: lightFg1,
|
|
Muted: lightFg4,
|
|
Accent: lightOrng,
|
|
|
|
Firing: lightRed,
|
|
Resolved: lightGrn,
|
|
Error: lightRed,
|
|
|
|
SevCritical: lightRed,
|
|
SevError: lightOrng,
|
|
SevWarning: lightYel,
|
|
SevInfo: lightAqua,
|
|
|
|
Identity: [6]lipgloss.Color{lightBlu, lightAqua, lightYel, lightGrn, lightOrng, lightPurple},
|
|
}
|
|
|
|
// Default is the theme used when the config names none.
|
|
var Default = GruvboxDark
|
|
|
|
var builtins = map[string]Theme{
|
|
GruvboxDark.Name: GruvboxDark,
|
|
GruvboxLight.Name: GruvboxLight,
|
|
}
|
|
|
|
// BuiltinNames lists the compiled-in themes, sorted, for error messages and
|
|
// documentation.
|
|
func BuiltinNames() []string {
|
|
names := make([]string, 0, len(builtins))
|
|
for name := range builtins {
|
|
names = append(names, name)
|
|
}
|
|
sort.Strings(names)
|
|
return names
|
|
}
|