diff options
Diffstat (limited to 'guile/starlet')
-rw-r--r-- | guile/starlet/colours.scm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/guile/starlet/colours.scm b/guile/starlet/colours.scm index c76ebf2..5b2877a 100644 --- a/guile/starlet/colours.scm +++ b/guile/starlet/colours.scm @@ -6,6 +6,7 @@ make-colour-cmy make-colour-rgb colour-as-cmy + colour-as-rgb interpolate-colour white)) @@ -64,6 +65,24 @@ (make-colour-cmy 0 0 0)) +(define (colour-as-rgb col) + (let ((val (colour-value col))) + (case (colour-type col) + + ((rgb) + val) + + ((cmy) + (list (- 100 (red val)) + (- 100 (green val)) + (- 100 (blue val)))) + + (else + (raise-exception (make-exception + (make-exception-with-message "Unrecognised colour type") + (make-exception-with-irritants (colour-type col)))))))) + + (define (colour-as-cmy col) (let ((val (colour-value col))) (case (colour-type col) |