Documentation
¶
Index ¶
- func BlendColor(c1, c2 color.Color, weight float64) color.Color
- func BlendColors(hex1 string, hex2 string, count int) ([]string, error)
- func Clamp(val, min, max int) int
- func ColorDistance(r1, g1, b1, r2, g2, b2 uint32) float64
- func ColorSimilarityWeight(c1, c2 color.Color, threshold float64) float64
- func ColorsToHex(colors []color.Color) []string
- func ConvertHexToFormat(hexColor, format string) (string, string, error)
- func DarkenColor(hex string, amount float64) (string, error)
- func GenerateAnalogous(hex string) ([]string, error)
- func GenerateComplementary(hex string) (string, error)
- func GenerateContrast(hex string) (string, error)
- func GenerateGradient(hexColors []string, width, height int, angle float64, ...) (image.Image, error)
- func GenerateMonochromatic(hex string, count int) ([]string, error)
- func GenerateQuadratic(hex string) ([]string, error)
- func GenerateShades(hex string, count int) ([]string, error)
- func GenerateSplitComplementary(hex string) ([]string, error)
- func GenerateTints(hex string, count int) ([]string, error)
- func GenerateTones(hex string, count int) ([]string, error)
- func GenerateTriadic(hex string) ([]string, error)
- func GetClrFormat(colorStr string) string
- func GetClrParseMap() map[string]func(string) (string, error)
- func HashPalette(colors []string) string
- func HexToRGBA(hexStr string) (color.RGBA, error)
- func HexToRGBASlice(hexColors []string) ([]color.Color, error)
- func HslToHex(hsl HSL) string
- func InvertColor(clr color.Color) color.Color
- func LabToHex(lab LAB) string
- func LightenColor(hex string, amount float64) (string, error)
- func ParseColorToHex(colorStr string) (string, error)
- func ParseHSLToHex(colorStr string) (string, error)
- func ParseHexToHex(colorStr string) (string, error)
- func ParseLabToHex(colorStr string) (string, error)
- func ParseRGBToHex(colorStr string) (string, error)
- func RGBtoHex(c color.RGBA) string
- func ToRGBA(clrs []color.Color) ([]color.RGBA, error)
- func ValidFormats() []string
- type ColorBox
- type GradientKeypoint
- type GradientTable
- type HSL
- type LAB
- type Transformation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorDistance ¶
func ColorSimilarityWeight ¶
func ColorsToHex ¶
func ConvertHexToFormat ¶
ConvertHexToFormat converts hex to the specified target format and returns (outputString, outputFormat, error)
func GenerateAnalogous ¶
func GenerateComplementary ¶
func GenerateContrast ¶
func GenerateGradient ¶
func GenerateGradient(hexColors []string, width, height int, angle float64, interpolationMethod string) (image.Image, error)
GenerateGradient creates a gradient image from a list of hex colors. angle: gradient direction in degrees (0=left→right, 90=top→bottom, 180=right→left, 270=bottom→top). hexColors: list of hex color strings (e.g., "#ff0000"). width, height: dimensions of the output image.
func GenerateQuadratic ¶
func GenerateTriadic ¶
func GetClrFormat ¶
GetClrFormat detects the format of the input color string
func GetClrParseMap ¶
GetClrParseMap returns the map of color format parsers
func HashPalette ¶
func ParseColorToHex ¶
ParseColorToHex parses any color format and converts it to hex
func ParseHSLToHex ¶
ParseHSLToHex parses HSL format and converts to hex
func ParseHexToHex ¶
ParseHexToHex validates and returns hex color
func ParseLabToHex ¶
ParseLabToHex parses LAB format and converts to hex
func ParseRGBToHex ¶
ParseRGBToHex parses RGB format and converts to hex
func ValidFormats ¶
func ValidFormats() []string
ValidFormats returns the list of valid color formats derived from the parser map
Types ¶
type ColorBox ¶
type ColorBox struct {
ColorStr string // The original color string (can be any format)
Box string // The colored box ANSI code
}
ColorBox represents a colored terminal box with its color value
func CreateColorBox ¶
CreateColorBox creates a colored box with ANSI codes from any color format
type GradientKeypoint ¶
GradientKeypoint represents a color at a specific position in the gradient
type GradientTable ¶
type GradientTable []GradientKeypoint
GradientTable contains the keypoints of the gradient
func (GradientTable) GetInterpolatedColorFor ¶
GetInterpolatedColorFor returns a HCL-blended color for position t [0,1]
type HSL ¶
type HSL struct {
H float64 // Hue: 0-360
S float64 // Saturation: 0-100
L float64 // Lightness: 0-100
}
HSL represents a color in Hue, Saturation, Lightness color space
type LAB ¶
type LAB struct {
L float64 // Lightness: 0-100
A float64 // Green-Red: -128 to 127
B float64 // Blue-Yellow: -128 to 127
}
LAB represents a color in CIE L*a*b* color space
type Transformation ¶
Transformation represents input colors -> output colors
func NewTransformation ¶
func NewTransformation(inputs []string, outputs []string) (*Transformation, error)
NewTransformation creates a transformation from input hex colors to output hex colors
func (*Transformation) Print ¶
func (t *Transformation) Print()
Print displays the transformation as: c1 box, c2 box, c3 box -> c4 box, c5 box
func (*Transformation) PrintCompact ¶
func (t *Transformation) PrintCompact()
PrintCompact displays transformation in compact format: inputs -> outputs (no hex labels)
func (*Transformation) PrintCustom ¶
func (t *Transformation) PrintCustom(separator, arrow string)
PrintCustom allows custom formatting with separator and arrow strings