Skip to content

Split form field state colors into text and decoration tokens (#801) - #806

Draft
adamkudrna wants to merge 1 commit into
masterfrom
feature/801-state-text-colors
Draft

adamkudrna wants to merge 1 commit into
masterfrom
feature/801-state-text-colors

Conversation

@adamkudrna

Copy link
Copy Markdown
Member

Text needs 4.5:1 contrast, while borders need only 3:1. Form field states get separate text tokens, so a theme can darken text without darkening decorations.

Changes

  • Add --rui-color-state-<state>-text, -text-hover and -text-active for valid, invalid, warning and changed.
  • Use them for the surrounding text and links of form fields in states.
  • Darken --rui-color-state-warning from #f59f00 to the former -hover value and use it for the warning border. -hover moves between the base and -active.
  • Document the text tokens in Foundation › Colors.

Visual changes in the default theme

  • Links in warning fields get the darker colors of the warning text.
  • --rui-color-state-warning and -hover are darker wherever used directly.
  • Borders, backgrounds, labels and help texts look the same.

Migration for custom themes

  • The warning border follows --rui-color-state-warning instead of -hover.
  • Warning links follow -text (by default -active) instead of the base, -hover and -active tokens.

Review notes

  • Nit: -text* aliases resolve on :root, so overriding a state color on a subtree no longer recolors links in states. Theming docs override tokens on :root only.
  • Nit: warning -text-hover and -text-active mix toward black, which lowers contrast in a dark theme unless overridden.
  • Nit: the docs do not say how the -text defaults are derived.
  • Nit: the comment above $state-warning-light is hard to follow.
  • Pre-existing (follow-up): default valid, invalid and warning text is below 4.5:1, and the warning border is below 3:1.

Closes #801

Text needs 4.5:1 contrast, while borders need only 3:1. Add
`--rui-color-state-<state>-text`, `-text-hover` and `-text-active`, and
use them for the surrounding text and links of form fields in states.

For the warning state, darken `--rui-color-state-warning` so the border
uses it directly. Warning links get the darker colors of the warning
text.

This branch had an error being deployed

1 failed deployment
pr-preview/pr-806 — a7ce66c0 Deployed Nov 30, 2026 by adamkudrna via Deploy PR Preview #198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BC Breaking change feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split form field state colors into text and decoration tokens

1 participant