summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sly/color.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/sly/color.scm b/sly/color.scm
index c8ba248..3384510 100644
--- a/sly/color.scm
+++ b/sly/color.scm
@@ -36,6 +36,7 @@
rgba
rgb
color*
+ color-scale
color+
color-
color-inverse
@@ -128,6 +129,13 @@ For example: #xffffff will return a color with RGBA values 1, 1, 1,
(* (color-a a)
(color-a b))))
+(define (color-scale c k)
+ "Multiple the RGBA channels of the color C by the scalar K."
+ (make-color (* (color-r c) k)
+ (* (color-g c) k)
+ (* (color-b c) k)
+ (* (color-a c) k)))
+
(define (color+ a b)
"Add the RGBA channels of colors A and B."
(make-color (+ (color-r a)