Skip to content

Add CSS color validation with selectable formats - #123

Merged
strider2038 merged 1 commit into
mainfrom
feat/css-color
Oct 2, 2026
Merged

strider2038 merged 1 commit into
mainfrom
feat/css-color

Conversation

@strider2038

Copy link
Copy Markdown
Contributor

Adds CSS color validation via it.IsCSSColor, validate.CSSColor, and is.CSSColor. With no format arguments, all 12 Symfony 8.0 categories are accepted; callers can restrict input, for example with it.IsCSSColor(validate.CSSColorRGB, validate.CSSColorRGBA).

Supports 3/4/6/8-digit hex, basic/extended names, system colors, transparent/currentColor, and legacy RGB/RGBA/HSL/HSLA functions. Patterns preserve Symfony's case, numeric-range, alpha, and whitespace rules. README explicitly documents unsupported modern CSS syntax and keywords. Unknown formats produce configuration errors, including in mixed selections (stricter than Symfony); nil/empty input is otherwise skipped.

Includes custom errors/messages, groups and conditional validation, generic This/Each support, English/Russian translations, examples, and an Unreleased changelog entry. No new dependencies.

Validation: bash scripts/test-all.sh passed (formatting, vet, golangci-lint v2.13.2, unit and race tests, module tidy and verification). Tests cover each format, cross-format rejection, RGB/HSL boundaries, alpha syntax, ASCII case handling, whitespace, malformed input, format selection, caller slice isolation, messages, and translations.

Closes #107.

@strider2038
strider2038 merged commit 4a937f2 into main Oct 2, 2026
4 checks passed
@strider2038
strider2038 deleted the feat/css-color branch October 2, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constraint: CssColor

1 participant