Formatting, subpackage rename

This commit is contained in:
2022-09-28 15:55:15 -07:00
parent e05a96df51
commit 73ef90d0c6
4 changed files with 16 additions and 12 deletions

View File

@@ -1,3 +0,0 @@
package color_hex
var Curated = append(Palettes["ESO MOTD Color Text"], append(Palettes["Cyberpunk Neon"], Palettes["cool"]...)...)

5
hexcolor/curated.go Normal file
View File

@@ -0,0 +1,5 @@
package hexcolor
var Curated = append(Palettes["ESO MOTD Color Text"],
append(Palettes["Cyberpunk Neon"],
Palettes["cool"]...)...)

View File

@@ -1,7 +1,7 @@
package color_hex package hexcolor
var palettes = map[string][]int{"#3": {0x2A4D69, var Palettes = map[string][]int{
0x4B86B4, 0xADCBE3, 0xE7EFF6, 0x63ACE5}, "#3": {0x2A4D69, 0x4B86B4, 0xADCBE3, 0xE7EFF6, 0x63ACE5},
"- Lips -": {0xF98787, 0xE76A6A, 0xD65B5B, 0xC14B4B, 0xB83F3F}, "- Lips -": {0xF98787, 0xE76A6A, 0xD65B5B, 0xC14B4B, 0xB83F3F},
"24K GOLD": {0xA67C00, 0xBF9B30, 0xFFBF00, 0xFFCF40, 0xFFDC73}, "24K GOLD": {0xA67C00, 0xBF9B30, 0xFFBF00, 0xFFCF40, 0xFFDC73},
"80s": {0xFF48C4, 0x2BD1FC, 0xF3EA5F, 0xC04DF9, 0xFF3F3F}, "80s": {0xFF48C4, 0x2BD1FC, 0xF3EA5F, 0xC04DF9, 0xFF3F3F},

View File

@@ -7,10 +7,12 @@ import (
"strings" "strings"
) )
type SimpleColor int type (
type NamedPalette map[string]SimpleColor SimpleColor int
type SimplePalette []SimpleColor NamedPalette map[string]SimpleColor
type conversionPalette []color.Color SimplePalette []SimpleColor
conversionPalette []color.Color
)
func (s SimplePalette) ToPalette() color.Palette { func (s SimplePalette) ToPalette() color.Palette {
var x color.Palette var x color.Palette
@@ -28,8 +30,8 @@ func (input SimpleColor) ToAnsi16() SimpleColor {
color := ansi[0:16].ToPalette().Convert(input) color := ansi[0:16].ToPalette().Convert(input)
r, g, b, _ := color.RGBA() r, g, b, _ := color.RGBA()
return SimpleColor(uint32(r)<<16 + uint32(g)<<8 + b) return SimpleColor(uint32(r)<<16 + uint32(g)<<8 + b)
} }
func (input SimpleColor) ToExtendedAnsi() SimpleColor { func (input SimpleColor) ToExtendedAnsi() SimpleColor {
color := ansi.ToPalette().Convert(input) color := ansi.ToPalette().Convert(input)
r, g, b, _ := color.RGBA() r, g, b, _ := color.RGBA()
@@ -78,7 +80,7 @@ func (p SimplePalette) ToAnsi16() (sp SimplePalette) {
return return
} }
func FromRGBA(r, g, b, a uint32) SimpleColor { func FromRGBA(r, g, b, _ uint32) SimpleColor {
c := r c := r
c = c<<8 + g c = c<<8 + g
c = c<<8 + b c = c<<8 + b