diff options
Diffstat (limited to 'internal/colors/precise.go')
-rw-r--r-- | internal/colors/precise.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/colors/precise.go b/internal/colors/precise.go index fafa104..a58d7c5 100644 --- a/internal/colors/precise.go +++ b/internal/colors/precise.go @@ -11,6 +11,10 @@ type ColorSpace interface { FromPrecise(PreciseColor) ColorSpace } +func (c PreciseColor) String() string { + return fmt.Sprintf("PC(%.4f, %.4f, %.4f)", c.R, c.G, c.B) +} + // PreciseColor is a color with floating point values for red, green, and blue. // The extra precision minimizes rounding errors when converting between different // color spaces. It is used as an intermediate representation when converting between @@ -27,7 +31,7 @@ func (c PreciseColor) FromPrecise(p PreciseColor) ColorSpace { return p } -func ToHexString(cs ColorSpace) string { +func Hex(cs ColorSpace) string { p := cs.ToPrecise() return strings.ToUpper(fmt.Sprintf("#%02x%02x%02x", |