package main // One palette, two variants, named by role. // // Catppuccin, because it is the scheme people already run in this terminal and // because its two variants are designed together: the same roles keep the same // meaning in light and dark. Panels ask for a role and never for a colour, so a // light terminal needs no second design. import ( "os" "strings" ) type palette struct { Base string Surface string Overlay string Text string Muted string Accent string Info string Success string Warning string Error string Mauve string Selection string } var mocha = palette{ Base: "#1e1e2e", Surface: "#313244", Overlay: "#6c7086", Text: "#cdd6f4", Muted: "#a6adc8", Accent: "#89b4fa", Info: "#94e2d5", Success: "#a6e3a1", Warning: "#f9e2af", Error: "#f38ba8", Mauve: "#cba6f7", Selection: "#45475a", } var latte = palette{ Base: "#eff1f5", Surface: "#ccd0da", Overlay: "#8c8fa1", Text: "#4c4f69", Muted: "#6c6f85", Accent: "#1e66f5", Info: "#179299", Success: "#40a02b", Warning: "#df8e1d", Error: "#d20f39", Mauve: "#8839ef", Selection: "#bcc0cc", } // active is the palette this run draws with. It is chosen once, at startup, so // nothing downstream has to think about it. var active = mocha func choosePalette(force string) { switch strings.ToLower(force) { case "light": active = latte case "dark": active = mocha default: // COLORFGBG is what many terminals export: "foreground;background". if v := os.Getenv("COLORFGBG"); v != "" { parts := strings.Split(v, ";") bg := parts[len(parts)-1] // A light background is one of the high numbers in the 16-colour // range; anything above 6 is light in practice. if bg == "15" || bg == "7" { active = latte } } } }