HexRgbColor

February 3, 2026 ยท View on GitHub

  • HexRgbColor()

Validates weather the input is a hex RGB color or not.

v::hexRgbColor()->assert('#FFFAAA');
// Validation passes successfully

v::hexRgbColor()->assert('#ff6600');
// Validation passes successfully

v::hexRgbColor()->assert('123123');
// Validation passes successfully

v::hexRgbColor()->assert('FCD');
// Validation passes successfully

Templates

HexRgbColor::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be a hex RGB color
inverted{{subject}} must not be a hex RGB color

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).

Categorization

  • Strings

Changelog

VersionDescription
2.1.0Allow hex RGB colors to be case-insensitive
2.0.0Allow hex RGB colors with 3 integers
0.7.0Created

See Also