Skip to content

Commit

Permalink
fix color validation condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Aug 3, 2023
1 parent 2840dca commit 72bdce5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Validation/Validator/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function validate(Validation $validation, $field): bool
*/
private function isValidColor(?string $color): bool
{
// Hexadecimal color regex pattern
$pattern = '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/';
// Hexadecimal color regex pattern (supports 3, 4, 6, or 8 digits)
$pattern = '/^#([A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/';

return preg_match($pattern, $color) === 1;
}
Expand Down

0 comments on commit 72bdce5

Please sign in to comment.