summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-11-29 12:37:41 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-11-29 12:37:41 -0500
commit35dc8aa24f7062a22e088d62e7ee8a47ec781f97 (patch)
tree0307e1d3248c3123e1429bf03fe2f4c24009530b
parent6047e3d432e2409079d361b59bc5c4b21c2b2f7f (diff)
render: color: Add transparency.
* sly/render/color.scm (transparency): New procedure.
-rw-r--r--sly/render/color.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/sly/render/color.scm b/sly/render/color.scm
index 6497339..80c7740 100644
--- a/sly/render/color.scm
+++ b/sly/render/color.scm
@@ -31,7 +31,7 @@
make-color
color?
color-r color-g color-b color-a
- rgba rgb
+ rgba rgb transparency
color* color+ color- color-inverse color-lerp
white black red green blue yellow magenta cyan transparent
tango-light-butter tango-butter tango-dark-butter
@@ -86,6 +86,11 @@ For example: #xffffff will return a color with RGBA values 1, 1, 1,
(color-component color-code 0)
1))
+(define (transparency alpha)
+ "Create a new color that is white with a transparency value of
+ALPHA. ALPHA is clamped to the range [0, 1]."
+ (make-color 1 1 1 alpha))
+
(define color*
(match-lambda*
((($ <color> r1 g1 b1 a1) ($ <color> r2 g2 b2 a2))