rgba
| (require rgba) |
RGBA color support used by the webview library.
This module exports a transparent rgba structure together with predicates and conversion procedures for working with CSS-style color values.
1 Overview
An rgba value represents a color using red, green, blue, and alpha components.
The module provides:
the rgba structure type
predicates for validating component values
conversion from strings to rgba values
conversion from rgba values to CSS color strings
The intended external representation is the CSS form:
"rgba(r,g,b,a)"
2 Predicates
A valid color component is an exact integer in the range from 0 to 255, inclusive.
A valid alpha component is a real number in the range from 0 to 1, inclusive.
3 Structure Type
struct
(struct rgba (r g b a))
r : rgba/color? g : rgba/color? b : rgba/color? a : rgba/alpha?
The fields r, g, and b are the red, green, and blue components. The field a is the alpha component.
The structure is transparent.
4 Conversion
procedure
(rgba->string c) → string?
c : rgba?
The result has the form:
"rgba(r,g,b,a)"
If parsing succeeds, the result is an rgba value. If parsing fails, the result is #f.
The accepted input format is the one produced by rgba->string, namely:
"rgba(r,g,b,a)"