toHex
Commons
stable
Convert a single 0–255 integer channel value to a zero-padded, uppercase 2-digit hexadecimal string. Used internally by RGBtoHex and HSVtoHex.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- vrequirednumber
- An integer colour channel value in the 0–255 range. The value is rounded before conversion.
API
Return value
The value returned by this util.
- A 2-character uppercase hex string, e.g. "0A", "FF", "1E".
Usage
Examples
Ready-to-paste usage snippets.
Convert integer channels to hex digits