Expand description
CSS color conversion helpers for HTML drawables.
These functions turn Cotis color types into CSS color strings used by
drawable_defaults (background-color, color, etc.).
§Default vs feature-gated API
Without features, all helpers take Color.
With complex_color, fill/background helpers take ColorLayer.
With complex_colored_text, text_color_css takes ColorLayer.
§Gradients
When features are enabled, only ColorLayer::Solid
produces a real CSS color. Other layer variants (linear, radial, layered) currently return
"transparent". Full CSS gradient mapping is on the roadmap.
Functions§
- color_
css - Formats a Cotis
Coloras a CSSrgba(r, g, b, a)string. - css_
alpha - Normalizes alpha to the 0.0–1.0 range expected by CSS
rgba(). - custom_
background_ css - CSS background color for custom HTML host elements.
- image_
background_ css - CSS background color behind an
Imagedrawable. - rectangle_
fill_ css - CSS
background-color(or fill) for aRectangle. - text_
color_ css - CSS
colorfor aTextdrawable.