package color
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module ColorSource
This module deals with colors.
Creates a color from integer RGB values between 0 and 255 and a floating point alpha value between 0.0 and 1.0. Algorithm adapted from: https://en.wikipedia.org/wiki/HSL_and_HSV
Creates a color from RGB and alpha values between 0.0 and 1.0
Creates a color from Hue, Saturation, Lightness and Alpha values. Hue is in degrees, a float value between 0.0 and 360.0. Saturation, Lightness and Alpha are float values between 0.0 and 1.0
Creates a color from Hue, Saturation and Lightness. Hue is in degrees, a float value between 0.0 and 360.0. Saturation and Lightness are float values between 0.0 and 1.0
Parse a hexadecimal color code. Handles short format like #rgb or long format #rrggbb. Short format #abc corresponds to long format #aabbcc.
Converts a color to its rgba value. All values are floats between 0.0 and 1.0
Converts a color to its rgba value. RGB values are integers in the range of 0 to 255. The alpha channel is a float between 0.0 and 1.0
Converts a color to its hexadecimal representation. The alpha channel is not represented.
The perceived brightness of a color. https://www.w3.org/TR/AERT/#color-contrast
The relative brightness of any color, normalized to 0. for darkest black and 1. for lightest white. https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
Contrast ratio between two colors. It is a value that can range from 1. to 21. https://www.w3.org/TR/2008/REC-WCAG20-20081211/#con<Paste>
Checks if text of one color is readable on a background of the second color. A minimum contrast ratio of 4.5 is recommended to ensure that text is readable on a given background. https://www.w3.org/TR/WCAG20-TECHS/G18.html