mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
dank16: enrich with hex, hex stripped, rgb
This commit is contained in:
@@ -6,135 +6,104 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GenerateJSON(colors []string) string {
|
||||
colorMap := make(map[string]string)
|
||||
|
||||
for i, color := range colors {
|
||||
colorMap[fmt.Sprintf("color%d", i)] = color
|
||||
}
|
||||
|
||||
marshalled, _ := json.Marshal(colorMap)
|
||||
|
||||
func GenerateJSON(p Palette) string {
|
||||
marshalled, _ := json.Marshal(p)
|
||||
return string(marshalled)
|
||||
}
|
||||
|
||||
func GenerateKittyTheme(colors []string) string {
|
||||
kittyColors := []struct {
|
||||
name string
|
||||
index int
|
||||
}{
|
||||
{"color0", 0},
|
||||
{"color1", 1},
|
||||
{"color2", 2},
|
||||
{"color3", 3},
|
||||
{"color4", 4},
|
||||
{"color5", 5},
|
||||
{"color6", 6},
|
||||
{"color7", 7},
|
||||
{"color8", 8},
|
||||
{"color9", 9},
|
||||
{"color10", 10},
|
||||
{"color11", 11},
|
||||
{"color12", 12},
|
||||
{"color13", 13},
|
||||
{"color14", 14},
|
||||
{"color15", 15},
|
||||
}
|
||||
|
||||
func GenerateKittyTheme(p Palette) string {
|
||||
var result strings.Builder
|
||||
for _, kc := range kittyColors {
|
||||
fmt.Fprintf(&result, "%s %s\n", kc.name, colors[kc.index])
|
||||
}
|
||||
fmt.Fprintf(&result, "color0 %s\n", p.Color0.Hex)
|
||||
fmt.Fprintf(&result, "color1 %s\n", p.Color1.Hex)
|
||||
fmt.Fprintf(&result, "color2 %s\n", p.Color2.Hex)
|
||||
fmt.Fprintf(&result, "color3 %s\n", p.Color3.Hex)
|
||||
fmt.Fprintf(&result, "color4 %s\n", p.Color4.Hex)
|
||||
fmt.Fprintf(&result, "color5 %s\n", p.Color5.Hex)
|
||||
fmt.Fprintf(&result, "color6 %s\n", p.Color6.Hex)
|
||||
fmt.Fprintf(&result, "color7 %s\n", p.Color7.Hex)
|
||||
fmt.Fprintf(&result, "color8 %s\n", p.Color8.Hex)
|
||||
fmt.Fprintf(&result, "color9 %s\n", p.Color9.Hex)
|
||||
fmt.Fprintf(&result, "color10 %s\n", p.Color10.Hex)
|
||||
fmt.Fprintf(&result, "color11 %s\n", p.Color11.Hex)
|
||||
fmt.Fprintf(&result, "color12 %s\n", p.Color12.Hex)
|
||||
fmt.Fprintf(&result, "color13 %s\n", p.Color13.Hex)
|
||||
fmt.Fprintf(&result, "color14 %s\n", p.Color14.Hex)
|
||||
fmt.Fprintf(&result, "color15 %s\n", p.Color15.Hex)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func GenerateFootTheme(colors []string) string {
|
||||
footColors := []struct {
|
||||
name string
|
||||
index int
|
||||
}{
|
||||
{"regular0", 0},
|
||||
{"regular1", 1},
|
||||
{"regular2", 2},
|
||||
{"regular3", 3},
|
||||
{"regular4", 4},
|
||||
{"regular5", 5},
|
||||
{"regular6", 6},
|
||||
{"regular7", 7},
|
||||
{"bright0", 8},
|
||||
{"bright1", 9},
|
||||
{"bright2", 10},
|
||||
{"bright3", 11},
|
||||
{"bright4", 12},
|
||||
{"bright5", 13},
|
||||
{"bright6", 14},
|
||||
{"bright7", 15},
|
||||
}
|
||||
|
||||
func GenerateFootTheme(p Palette) string {
|
||||
var result strings.Builder
|
||||
for _, fc := range footColors {
|
||||
fmt.Fprintf(&result, "%s=%s\n", fc.name, strings.TrimPrefix(colors[fc.index], "#"))
|
||||
}
|
||||
fmt.Fprintf(&result, "regular0=%s\n", p.Color0.HexStripped)
|
||||
fmt.Fprintf(&result, "regular1=%s\n", p.Color1.HexStripped)
|
||||
fmt.Fprintf(&result, "regular2=%s\n", p.Color2.HexStripped)
|
||||
fmt.Fprintf(&result, "regular3=%s\n", p.Color3.HexStripped)
|
||||
fmt.Fprintf(&result, "regular4=%s\n", p.Color4.HexStripped)
|
||||
fmt.Fprintf(&result, "regular5=%s\n", p.Color5.HexStripped)
|
||||
fmt.Fprintf(&result, "regular6=%s\n", p.Color6.HexStripped)
|
||||
fmt.Fprintf(&result, "regular7=%s\n", p.Color7.HexStripped)
|
||||
fmt.Fprintf(&result, "bright0=%s\n", p.Color8.HexStripped)
|
||||
fmt.Fprintf(&result, "bright1=%s\n", p.Color9.HexStripped)
|
||||
fmt.Fprintf(&result, "bright2=%s\n", p.Color10.HexStripped)
|
||||
fmt.Fprintf(&result, "bright3=%s\n", p.Color11.HexStripped)
|
||||
fmt.Fprintf(&result, "bright4=%s\n", p.Color12.HexStripped)
|
||||
fmt.Fprintf(&result, "bright5=%s\n", p.Color13.HexStripped)
|
||||
fmt.Fprintf(&result, "bright6=%s\n", p.Color14.HexStripped)
|
||||
fmt.Fprintf(&result, "bright7=%s\n", p.Color15.HexStripped)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func GenerateAlacrittyTheme(colors []string) string {
|
||||
alacrittyColors := []struct {
|
||||
section string
|
||||
name string
|
||||
index int
|
||||
}{
|
||||
{"normal", "black", 0},
|
||||
{"normal", "red", 1},
|
||||
{"normal", "green", 2},
|
||||
{"normal", "yellow", 3},
|
||||
{"normal", "blue", 4},
|
||||
{"normal", "magenta", 5},
|
||||
{"normal", "cyan", 6},
|
||||
{"normal", "white", 7},
|
||||
{"bright", "black", 8},
|
||||
{"bright", "red", 9},
|
||||
{"bright", "green", 10},
|
||||
{"bright", "yellow", 11},
|
||||
{"bright", "blue", 12},
|
||||
{"bright", "magenta", 13},
|
||||
{"bright", "cyan", 14},
|
||||
{"bright", "white", 15},
|
||||
}
|
||||
|
||||
func GenerateAlacrittyTheme(p Palette) string {
|
||||
var result strings.Builder
|
||||
currentSection := ""
|
||||
for _, ac := range alacrittyColors {
|
||||
if ac.section != currentSection {
|
||||
if currentSection != "" {
|
||||
result.WriteString("\n")
|
||||
}
|
||||
fmt.Fprintf(&result, "[colors.%s]\n", ac.section)
|
||||
currentSection = ac.section
|
||||
}
|
||||
fmt.Fprintf(&result, "%-7s = '%s'\n", ac.name, colors[ac.index])
|
||||
}
|
||||
result.WriteString("[colors.normal]\n")
|
||||
fmt.Fprintf(&result, "black = '%s'\n", p.Color0.Hex)
|
||||
fmt.Fprintf(&result, "red = '%s'\n", p.Color1.Hex)
|
||||
fmt.Fprintf(&result, "green = '%s'\n", p.Color2.Hex)
|
||||
fmt.Fprintf(&result, "yellow = '%s'\n", p.Color3.Hex)
|
||||
fmt.Fprintf(&result, "blue = '%s'\n", p.Color4.Hex)
|
||||
fmt.Fprintf(&result, "magenta = '%s'\n", p.Color5.Hex)
|
||||
fmt.Fprintf(&result, "cyan = '%s'\n", p.Color6.Hex)
|
||||
fmt.Fprintf(&result, "white = '%s'\n", p.Color7.Hex)
|
||||
result.WriteString("\n[colors.bright]\n")
|
||||
fmt.Fprintf(&result, "black = '%s'\n", p.Color8.Hex)
|
||||
fmt.Fprintf(&result, "red = '%s'\n", p.Color9.Hex)
|
||||
fmt.Fprintf(&result, "green = '%s'\n", p.Color10.Hex)
|
||||
fmt.Fprintf(&result, "yellow = '%s'\n", p.Color11.Hex)
|
||||
fmt.Fprintf(&result, "blue = '%s'\n", p.Color12.Hex)
|
||||
fmt.Fprintf(&result, "magenta = '%s'\n", p.Color13.Hex)
|
||||
fmt.Fprintf(&result, "cyan = '%s'\n", p.Color14.Hex)
|
||||
fmt.Fprintf(&result, "white = '%s'\n", p.Color15.Hex)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func GenerateGhosttyTheme(colors []string) string {
|
||||
func GenerateGhosttyTheme(p Palette) string {
|
||||
var result strings.Builder
|
||||
for i, color := range colors {
|
||||
fmt.Fprintf(&result, "palette = %d=%s\n", i, color)
|
||||
}
|
||||
fmt.Fprintf(&result, "palette = 0=%s\n", p.Color0.Hex)
|
||||
fmt.Fprintf(&result, "palette = 1=%s\n", p.Color1.Hex)
|
||||
fmt.Fprintf(&result, "palette = 2=%s\n", p.Color2.Hex)
|
||||
fmt.Fprintf(&result, "palette = 3=%s\n", p.Color3.Hex)
|
||||
fmt.Fprintf(&result, "palette = 4=%s\n", p.Color4.Hex)
|
||||
fmt.Fprintf(&result, "palette = 5=%s\n", p.Color5.Hex)
|
||||
fmt.Fprintf(&result, "palette = 6=%s\n", p.Color6.Hex)
|
||||
fmt.Fprintf(&result, "palette = 7=%s\n", p.Color7.Hex)
|
||||
fmt.Fprintf(&result, "palette = 8=%s\n", p.Color8.Hex)
|
||||
fmt.Fprintf(&result, "palette = 9=%s\n", p.Color9.Hex)
|
||||
fmt.Fprintf(&result, "palette = 10=%s\n", p.Color10.Hex)
|
||||
fmt.Fprintf(&result, "palette = 11=%s\n", p.Color11.Hex)
|
||||
fmt.Fprintf(&result, "palette = 12=%s\n", p.Color12.Hex)
|
||||
fmt.Fprintf(&result, "palette = 13=%s\n", p.Color13.Hex)
|
||||
fmt.Fprintf(&result, "palette = 14=%s\n", p.Color14.Hex)
|
||||
fmt.Fprintf(&result, "palette = 15=%s\n", p.Color15.Hex)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func GenerateWeztermTheme(colors []string) string {
|
||||
func GenerateWeztermTheme(p Palette) string {
|
||||
var result strings.Builder
|
||||
labels := []string{"ansi", "brights"}
|
||||
for j, label := range labels {
|
||||
start := j * 8
|
||||
colorSlice := make([]string, 8)
|
||||
for i, color := range colors[start : start+8] {
|
||||
colorSlice[i] = fmt.Sprintf("'%s'", color)
|
||||
}
|
||||
fmt.Fprintf(&result, "%s = [%s]\n", label, strings.Join(colorSlice, ", "))
|
||||
}
|
||||
fmt.Fprintf(&result, "ansi = ['%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']\n",
|
||||
p.Color0.Hex, p.Color1.Hex, p.Color2.Hex, p.Color3.Hex,
|
||||
p.Color4.Hex, p.Color5.Hex, p.Color6.Hex, p.Color7.Hex)
|
||||
fmt.Fprintf(&result, "brights = ['%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']\n",
|
||||
p.Color8.Hex, p.Color9.Hex, p.Color10.Hex, p.Color11.Hex,
|
||||
p.Color12.Hex, p.Color13.Hex, p.Color14.Hex, p.Color15.Hex)
|
||||
return result.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user