aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-11-06 13:28:45 +0100
committerThomas White <taw@physics.org>2021-11-06 13:28:45 +0100
commitcf899e0439cf4fbfbda8138c3152d540c7838e5f (patch)
tree735da9b9226962cee8512f5af82a3638ce91b7cf
parent7208eecd64ab315fa0c1d3113a3793d20491fb73 (diff)
Add colour-as-rgbw
-rw-r--r--guile/starlet/colours.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guile/starlet/colours.scm b/guile/starlet/colours.scm
index c7d1de0..f18b986 100644
--- a/guile/starlet/colours.scm
+++ b/guile/starlet/colours.scm
@@ -27,6 +27,7 @@
make-colour-rgb
colour-as-cmy
colour-as-rgb
+ colour-as-rgbw
cyan
magenta
@@ -117,6 +118,15 @@
(make-exception-with-irritants (colour-type col))))))))
+(define (colour-as-rgbw col)
+ (let ((rgb (colour-as-rgb col)))
+ (let ((w (apply min rgb)))
+ (list (- (red rgb) w)
+ (- (green rgb) w)
+ (- (blue rgb) w)
+ w))))
+
+
(define (colour-as-cmy col)
(let ((val (colour-value col)))
(case (colour-type col)