Back to Validation

HexRgbColor

docs/validators/HexRgbColor.md

3.1.11.5 KB
Original Source
<!-- SPDX-License-Identifier: MIT SPDX-FileCopyrightText: (c) Respect Project Contributors SPDX-FileContributor: Alexandre Gomes Gaigalas <[email protected]> SPDX-FileContributor: Henrique Moody <[email protected]> -->

HexRgbColor

  • HexRgbColor()

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

php
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