From cae1727bf5fa10a4cd54583e2d59e90326c70775 Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Tue, 11 Oct 2022 15:12:47 -0500 Subject: [PATCH 1/4] fix: Removed ineffectual assignment --- main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.go b/main.go index 311940f..f0280e3 100644 --- a/main.go +++ b/main.go @@ -4,13 +4,11 @@ import ( "fmt" "strings" - "github.com/taigrr/simplecolorpalettes/palettes/material" "github.com/taigrr/simplecolorpalettes/palettes/vim/luna" ) func main() { - colors := material.GetShadesForColorName(material.Red) - colors = luna.GetPalette() + colors := luna.GetPalette() colors = colors.ToExtendedAnsi() var open []string var close []string From 442b4f8b6fab1e3e8dbca251d81e0f165bb37a26 Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Tue, 11 Oct 2022 15:14:31 -0500 Subject: [PATCH 2/4] style: Gofumpt formatting changes --- palettes/ansi/ansi.go | 3 ++- simplecolor/ansi.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/palettes/ansi/ansi.go b/palettes/ansi/ansi.go index a934107..156a81d 100644 --- a/palettes/ansi/ansi.go +++ b/palettes/ansi/ansi.go @@ -40,4 +40,5 @@ var Ansi = simplecolor.SimplePalette{ 0xFFFFFF, 0x080808, 0x121212, 0x1C1C1C, 0x262626, 0x303030, 0x3A3A3A, 0x444444, 0x4E4E4E, 0x585858, 0x626262, 0x6C6C6C, 0x767676, 0x808080, 0x8A8A8A, 0x949494, 0x9E9E9E, 0xA8A8A8, 0xB2B2B2, 0xBCBCBC, 0xC6C6C6, - 0xD0D0D0, 0xDADADA, 0xE4E4E4, 0xEEEEEE} + 0xD0D0D0, 0xDADADA, 0xE4E4E4, 0xEEEEEE, +} diff --git a/simplecolor/ansi.go b/simplecolor/ansi.go index 908a196..3b73557 100644 --- a/simplecolor/ansi.go +++ b/simplecolor/ansi.go @@ -38,4 +38,5 @@ var ansi = SimplePalette{ 0xFFFFFF, 0x080808, 0x121212, 0x1C1C1C, 0x262626, 0x303030, 0x3A3A3A, 0x444444, 0x4E4E4E, 0x585858, 0x626262, 0x6C6C6C, 0x767676, 0x808080, 0x8A8A8A, 0x949494, 0x9E9E9E, 0xA8A8A8, 0xB2B2B2, 0xBCBCBC, 0xC6C6C6, - 0xD0D0D0, 0xDADADA, 0xE4E4E4, 0xEEEEEE} + 0xD0D0D0, 0xDADADA, 0xE4E4E4, 0xEEEEEE, +} From db9002982dc72351d6d4d94c9afe0888430e3986 Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Tue, 11 Oct 2022 15:15:39 -0500 Subject: [PATCH 3/4] fix: Commented out unused colors in theme --- palettes/material/material.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/palettes/material/material.go b/palettes/material/material.go index 624f17f..12ea583 100644 --- a/palettes/material/material.go +++ b/palettes/material/material.go @@ -28,18 +28,19 @@ var ( "800": 0x6a1b9a, "900": 0x4a148c, "A100": 0xea80fc, "A200": 0xe040fb, "A400": 0xd500f9, "A700": 0xaa00ff, } - deepPurple = simplecolor.NamedPalette{ - "50": 0xede7f6, "100": 0xd1c4e9, "200": 0xb39ddb, "300": 0x9575cd, - "400": 0x7e57c2, "500": 0x673ab7, "600": 0x5e35b1, "700": 0x512da8, - "800": 0x4527a0, "900": 0x311b92, "A100": 0xb388ff, "A200": 0x7c4dff, - "A400": 0x651fff, "A700": 0x6200ea, - } - indigo = simplecolor.NamedPalette{ - "50": 0xe8eaf6, "100": 0xc5cae9, "200": 0x9fa8da, "300": 0x7986cb, - "400": 0x5c6bc0, "500": 0x3f51b5, "600": 0x3949ab, "700": 0x303f9f, - "800": 0x283593, "900": 0x1a237e, "A100": 0x8c9eff, "A200": 0x536dfe, - "A400": 0x3d5afe, "A700": 0x304ffe, - } + // Removed as not used, leaving in for future use if needed. + // deepPurple = simplecolor.NamedPalette{ + // "50": 0xede7f6, "100": 0xd1c4e9, "200": 0xb39ddb, "300": 0x9575cd, + // "400": 0x7e57c2, "500": 0x673ab7, "600": 0x5e35b1, "700": 0x512da8, + // "800": 0x4527a0, "900": 0x311b92, "A100": 0xb388ff, "A200": 0x7c4dff, + // "A400": 0x651fff, "A700": 0x6200ea, + // } + // indigo = simplecolor.NamedPalette{ + // "50": 0xe8eaf6, "100": 0xc5cae9, "200": 0x9fa8da, "300": 0x7986cb, + // "400": 0x5c6bc0, "500": 0x3f51b5, "600": 0x3949ab, "700": 0x303f9f, + // "800": 0x283593, "900": 0x1a237e, "A100": 0x8c9eff, "A200": 0x536dfe, + // "A400": 0x3d5afe, "A700": 0x304ffe, + // } blue = simplecolor.NamedPalette{ "50": 0xe3f2fd, "100": 0xbbdefb, "200": 0x90caf9, "300": 0x64b5f6, "400": 0x42a5f5, "500": 0x2196f3, "600": 0x1e88e5, "700": 0x1976d2, From bdf265b7a362c3a79052966b9a460cd4335b60fa Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Tue, 11 Oct 2022 15:16:19 -0500 Subject: [PATCH 4/4] style: Updated to include consistent naming of variables --- simplecolor/simplecolors.go | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/simplecolor/simplecolors.go b/simplecolor/simplecolors.go index dbf49a1..f6f6e48 100644 --- a/simplecolor/simplecolors.go +++ b/simplecolor/simplecolors.go @@ -33,15 +33,15 @@ func (n NamedPalette) ToPalette() color.Palette { return color.Palette(x) } -func (a SimplePalette) Sort() SimplePalette { - sort.Sort(a) - return a +func (s SimplePalette) Sort() SimplePalette { + sort.Sort(s) + return s } -func (a SimplePalette) Join(b SimplePalette) SimplePalette { +func (s SimplePalette) Join(b SimplePalette) SimplePalette { m := make(map[SimpleColor]SimpleColor) r := SimplePalette{} - for _, c := range a { + for _, c := range s { m[c] = c } for _, c := range b { @@ -80,32 +80,32 @@ func (c SimpleColor) ToShortHex() string { return "#" + fmt.Sprintf("%06X", value) } -func (s SimpleColor) RGBA() (r, g, b, a uint32) { - return uint32(s) >> 16 & 0xFF, uint32(s) >> 8 & 0xFF, uint32(s) & 0xFF, 0xFF +func (c SimpleColor) RGBA() (r, g, b, a uint32) { + return uint32(c) >> 16 & 0xFF, uint32(c) >> 8 & 0xFF, uint32(c) & 0xFF, 0xFF } -func (input SimpleColor) ToAnsi16() SimpleColor { - color := ansi[0:16].ToPalette().Convert(input) +func (c SimpleColor) ToAnsi16() SimpleColor { + color := ansi[0:16].ToPalette().Convert(c) r, g, b, _ := color.RGBA() return SimpleColor(uint32(r)<<16 + uint32(g)<<8 + b) } -func (input SimpleColor) ToExtendedAnsi() SimpleColor { - color := ansi.ToPalette().Convert(input) +func (c SimpleColor) ToExtendedAnsi() SimpleColor { + color := ansi.ToPalette().Convert(c) r, g, b, _ := color.RGBA() return SimpleColor(uint32(r)<<16 + uint32(g)<<8 + b) } -func (p NamedPalette) ToExtendedAnsi() NamedPalette { - for k, v := range p { - p[k] = v.ToExtendedAnsi() +func (n NamedPalette) ToExtendedAnsi() NamedPalette { + for k, v := range n { + n[k] = v.ToExtendedAnsi() } - return p + return n } -func (p SimplePalette) ToExtendedAnsi() (sp SimplePalette) { +func (s SimplePalette) ToExtendedAnsi() (sp SimplePalette) { used := make(map[SimpleColor]bool) - for _, x := range p { + for _, x := range s { clampedColor := x.ToExtendedAnsi() if _, found := used[clampedColor]; found { continue @@ -118,21 +118,21 @@ func (p SimplePalette) ToExtendedAnsi() (sp SimplePalette) { return } -func (e SimplePalette) Len() int { - return len(e) +func (s SimplePalette) Len() int { + return len(s) } -func (e SimplePalette) Less(i, j int) bool { - return int(e[i]) < int(e[j]) +func (s SimplePalette) Less(i, j int) bool { + return int(s[i]) < int(s[j]) } -func (e SimplePalette) Swap(i, j int) { - e[i], e[j] = e[j], e[i] +func (s SimplePalette) Swap(i, j int) { + s[i], s[j] = s[j], s[i] } -func (p SimplePalette) ToAnsi16() (sp SimplePalette) { +func (s SimplePalette) ToAnsi16() (sp SimplePalette) { used := make(map[SimpleColor]bool) - for _, x := range p { + for _, x := range s { clampedColor := x.ToAnsi16() if _, found := used[clampedColor]; found { continue