Module colorizer.parser.oklch
OKLCH Parser
This module provides a parser for identifying and converting oklch() CSS functions to RGB hexadecimal format.
OKLCH is a perceptual color space that provides better uniformity than HSL. It supports lightness as both decimal (0-1) and percentage (0-100%), chroma values, hue in degrees, and optional alpha transparency. This function is useful for syntax highlighting or color recognition in a text editor.
Functions
| parser (line, i, _) | Parses oklch() CSS functions and converts them to RGB hexadecimal format. |
Tables
| spec | Parser spec for the registry |
Functions
- parser (line, i, _)
-
Parses
oklch()CSS functions and converts them to RGB hexadecimal format. This function matchesoklch()functions within a line of text, extracting and converting the lightness, chroma, and hue to an RGB color. It handles lightness as decimal or percentage, and an optional alpha (transparency) value.