From 4d25e4ece0b72d240bb2565f8abb7389e650990a Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 23 Nov 2024 21:05:11 -0500 Subject: Preview + Unit-tests for color conversions --- internal/colors/cmyk.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/colors/cmyk.go') diff --git a/internal/colors/cmyk.go b/internal/colors/cmyk.go index 3460c4e..b5ef223 100644 --- a/internal/colors/cmyk.go +++ b/internal/colors/cmyk.go @@ -1,6 +1,9 @@ package colors -import "math" +import ( + "fmt" + "math" +) type CMYK struct { C int // 0-100 @@ -9,6 +12,10 @@ type CMYK struct { K int // 0-100 } +func (c CMYK) String() string { + return fmt.Sprintf("cmyk(%d, %d, %d, %d)", c.C, c.M, c.Y, c.K) +} + func (c CMYK) ToPrecise() PreciseColor { return PreciseColor{ R: (1 - float64(c.C)/100) * (1 - float64(c.K)/100), -- cgit v1.2.3