Color filters

Color filters change or extract properties from CSS color strings. These filters are commonly used with color theme settings.

color_to_rgb

Converts a CSS color string to CSS rgb() format.

If the input color has an alpha component, then the output will be in CSS rgba() format.

color_to_hsl

Converts a CSS color string to CSS hsl() format.

If the input color has an alpha component, then the output will be in CSS hsla() format.

color_to_hex

Converts a CSS color string to hex6 format.

Hex output is always in hex6 format. If there is an alpha channel in the input color, it will not appear in the output.

color_extract

Extracts a component from the color. Valid components are alpha, red, green, blue, hue, saturation and lightness.

color_brightness

Calculates the perceived brightness of the given color. Uses W3C recommendations for calculating perceived brightness, for the purpose of ensuring adequate contrast.