Module colorizer.parser.rgb_hex

This module provides a parser for extracting `0xAARRGGBB` hexadecimal color values and converting them to RGB hex.

This format is commonly used in Android apps for color values, where the color includes an alpha (transparency) component. The function parses the color, applies the alpha value to each RGB channel, and returns the resulting RGB hex string.

Functions

parser (line, i) Parses a `0xAARRGGBB` formatted hexadecimal color and converts it to an RGB hex value.


Functions

parser (line, i)
Parses a `0xAARRGGBB` formatted hexadecimal color and converts it to an RGB hex value. This function reads a color from a line of text, expecting it in the `0xAARRGGBB` format (common in Android apps). It extracts the alpha (AA), red (RR), green (GG), and blue (BB) components, applies the alpha to the RGB channels, and outputs the resulting RGB color in hexadecimal format.

Parameters:

  • line string The line of text to parse
  • i number The starting index within the line where parsing should begin

Returns:

  1. number|nil The end index of the parsed hex value within the line, or `nil` if parsing failed
  2. string|nil The RGB hexadecimal color (e.g., "ff0000" for red), or `nil` if parsing failed
generated by LDoc 1.5.0 Last updated - December