How this tool computes its result
rgbToHex clamps each channel to 0–255 (rounding and bounding via clampChannel) then maps each to a 2-digit uppercase hex string, concatenated with a leading "#". hexToRgb validates the input against a strict regex requiring exactly 3 or 6 hex digits after an optional "#"; a 3-digit shorthand is expanded by doubling each character (e.g. "F0A" → "FF00AA") before being parsed to decimal R/G/B via parseInt with base 16.
