Sync theme registries and support webterm-theme key in landing YAML
Two issues prevented themes from being applied: 1. Three server-side themes (miasma, github, gotham) were missing from the frontend THEMES map in terminal.ts, causing the browser to silently ignore them when set via data-theme attribute. 2. Landing YAML only recognized the 'theme' key, but users writing 'webterm-theme' (matching the Docker label convention) got no theme. Now LoadLandingYAML accepts both 'theme' and 'webterm-theme' keys. All 16 themes are now consistent across ThemeBackgrounds, ThemePalettes, and the frontend THEMES map.
This commit is contained in:
+10
-1
@@ -61,7 +61,7 @@ func LoadLandingYAML(manifestPath string) ([]App, error) {
|
||||
Path: path,
|
||||
Color: asString(entry["color"]),
|
||||
Terminal: terminal,
|
||||
Theme: asString(entry["theme"]),
|
||||
Theme: firstNonEmpty(asString(entry["theme"]), asString(entry["webterm-theme"])),
|
||||
})
|
||||
}
|
||||
return apps, nil
|
||||
@@ -144,3 +144,12 @@ func asString(value any) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func firstNonEmpty(values ...string) string {
|
||||
for _, v := range values {
|
||||
if v != "" {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -30,6 +30,35 @@ func TestLoadLandingYAML(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadLandingYAMLWebtermThemeKey(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "landing.yaml")
|
||||
content := `
|
||||
- name: Pro
|
||||
command: /bin/sh
|
||||
webterm-theme: monokai-pro
|
||||
- name: Classic
|
||||
command: /bin/sh
|
||||
theme: dracula
|
||||
`
|
||||
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
apps, err := LoadLandingYAML(path)
|
||||
if err != nil {
|
||||
t.Fatalf("LoadLandingYAML() error = %v", err)
|
||||
}
|
||||
if len(apps) != 2 {
|
||||
t.Fatalf("expected 2 apps, got %d", len(apps))
|
||||
}
|
||||
if apps[0].Theme != "monokai-pro" {
|
||||
t.Fatalf("expected monokai-pro from webterm-theme key, got %q", apps[0].Theme)
|
||||
}
|
||||
if apps[1].Theme != "dracula" {
|
||||
t.Fatalf("expected dracula from theme key, got %q", apps[1].Theme)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadComposeManifestReadsLabels(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "compose.yaml")
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -352,6 +352,81 @@ const THEMES: Record<string, ITheme> = {
|
||||
brightCyan: "#7dcfff",
|
||||
brightWhite: "#c0caf5",
|
||||
},
|
||||
// Miasma - earthy warm tones
|
||||
miasma: {
|
||||
background: "#222222",
|
||||
foreground: "#c2c2b0",
|
||||
cursor: "#c2c2b0",
|
||||
cursorAccent: "#222222",
|
||||
selectionBackground: "#c2c2b0",
|
||||
selectionForeground: "#222222",
|
||||
black: "#000000",
|
||||
red: "#685742",
|
||||
green: "#5f875f",
|
||||
yellow: "#b36d43",
|
||||
blue: "#78824b",
|
||||
magenta: "#bb7744",
|
||||
cyan: "#c9a554",
|
||||
white: "#d7c483",
|
||||
brightBlack: "#666666",
|
||||
brightRed: "#685742",
|
||||
brightGreen: "#5f875f",
|
||||
brightYellow: "#b36d43",
|
||||
brightBlue: "#78824b",
|
||||
brightMagenta: "#bb7744",
|
||||
brightCyan: "#c9a554",
|
||||
brightWhite: "#d7c483",
|
||||
},
|
||||
// GitHub Dark Dimmed
|
||||
github: {
|
||||
background: "#1c2128",
|
||||
foreground: "#adbac7",
|
||||
cursor: "#adbac7",
|
||||
cursorAccent: "#1c2128",
|
||||
selectionBackground: "#adbac7",
|
||||
selectionForeground: "#1c2128",
|
||||
black: "#545d68",
|
||||
red: "#f47067",
|
||||
green: "#57ab5a",
|
||||
yellow: "#c69026",
|
||||
blue: "#539bf5",
|
||||
magenta: "#b083f0",
|
||||
cyan: "#39c5cf",
|
||||
white: "#909dab",
|
||||
brightBlack: "#636e7b",
|
||||
brightRed: "#ff938a",
|
||||
brightGreen: "#6bc46d",
|
||||
brightYellow: "#daaa3f",
|
||||
brightBlue: "#6cb6ff",
|
||||
brightMagenta: "#dcbdfb",
|
||||
brightCyan: "#56d4dd",
|
||||
brightWhite: "#cdd9e5",
|
||||
},
|
||||
// Gotham - dark blue-cyan
|
||||
gotham: {
|
||||
background: "#0c1014",
|
||||
foreground: "#99d1ce",
|
||||
cursor: "#99d1ce",
|
||||
cursorAccent: "#0c1014",
|
||||
selectionBackground: "#99d1ce",
|
||||
selectionForeground: "#0c1014",
|
||||
black: "#0c1014",
|
||||
red: "#c23127",
|
||||
green: "#2aa889",
|
||||
yellow: "#edb443",
|
||||
blue: "#195466",
|
||||
magenta: "#4e5166",
|
||||
cyan: "#33859e",
|
||||
white: "#99d1ce",
|
||||
brightBlack: "#0c1014",
|
||||
brightRed: "#c23127",
|
||||
brightGreen: "#2aa889",
|
||||
brightYellow: "#edb443",
|
||||
brightBlue: "#195466",
|
||||
brightMagenta: "#4e5166",
|
||||
brightCyan: "#33859e",
|
||||
brightWhite: "#99d1ce",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user