Module colorizer.parser.rgb
RGB Parser
This module provides a parser for identifying and converting rgb() and rgba() CSS functions to RGB hexadecimal format.
It supports decimal and percentage values for RGB channels, as well as an optional alpha (transparency) component. The function can interpret a variety of CSS syntax variations, making it useful for syntax highlighting or color parsing.
Functions
| parser (line, i, opts) | Parses rgb() and rgba() CSS functions and converts them to RGB hexadecimal format. |
Tables
| spec | Parser spec for the registry |
Functions
- parser (line, i, opts)
-
Parses
rgb()andrgba()CSS functions and converts them to RGB hexadecimal format. This function matchesrgb()orrgba()functions in a line of text, extracting RGB and optional alpha values. It supports decimal and percentage formats, alpha transparency, and comma or space-separated CSS syntax.