Educational guide to accent-color
Color native controls without rebuilding them
accent-color proposes an accent for native controls. The browser keeps their shape, interaction, and states; you choose the color and check the result.
Mental model
An inherited accent, not a complete paint job for the control.
It accepts auto or a color. auto leaves the choice to the browser: it does not promise a particular shade or always reproduce the system accent. The property inherits, so you can set it on a container; a declaration applied directly to an input takes priority over the inherited value.
It affects the parts that the browser draws with an accent. It does not define the shape, size, every background, or the focus indicator. Keep native appearance: removing it with appearance: none may remove the part you expected to tint.
Controls and states
Try checkbox, radio, range, and progress with one declaration.
These are the four controls currently documented. Toggle checkboxes, change plans with arrow keys, and adjust the slider. Not every state uses the accent: unchecked or disabled controls may keep browser colors. progress shows a fixed 60% here; moving the range does not update it.
A shared accent and an exception with auto
accent-color: inherit on controls makes inheritance explicit even if a general rule assigns them an accent. The radio group name is exclusive to this example. A checkbox’s indeterminate state is set with JavaScript; accent-color only contributes to its presentation.
Themes and contrast
The same control needs checking against its actual backgrounds.
color-scheme tells the browser which schemes an area supports and affects native appearance; it does not automatically change all author colors. This comparison forces light and dark on two groups, uses Canvas/CanvasText for their surfaces, and chooses an accent for each. On a page supporting both schemes, color-scheme: light dark follows the user’s preference.
Native comparison in light and dark
The browser may adjust the accent or checkmark color to preserve legibility, but this does not guarantee accessible contrast. Check marks, boundaries, backgrounds, and focus in relevant states and target browsers. In forced colors, allow the user’s palette to take effect; do not impose forced-color-adjust: none to preserve branding.
Common pitfalls
Check the element, state, and background before adding CSS.
The select or text field does not change
- Expected result
- Customize every field with the same accent.
- Cause
- accent-color is not a general tinting API for select, buttons, text fields, or meter.
- Solution
- Choose the tool for the need: control CSS, customizable select for presentation, or field-sizing for size. Keep labels, keyboard behavior, and focus.
The disabled checkbox does not keep the exact color
- Expected result
- Use the same shade across every state and platform.
- Cause
- Native appearance decides when to use the accent and may adjust its colors.
- Solution
- Allow native differences and check checked, unchecked, disabled, hover, and focus states. Redesigning the entire control goes beyond accent-color.
The brand color is visible, but the control is hard to read
- Expected result
- Distinguish the state and locate focus clearly.
- Cause
- An accent close to its background or an insufficient browser adjustment can hide details. Syntax support does not prove contrast.
- Solution
- Check the composed result in both themes, keep visible focus, and test forced colors. Change the accent if needed; do not communicate state through color alone.
Support and compatibility
The declaration and the visual result need separate checks.
Check Baseline status and browser details. BCD records a contrast limitation in Chrome for Android and Safari before 26.2. Do not extrapolate this preview’s result to other platforms or every state.
Without support, the declaration is ignored and the native control remains. That is the fallback in these examples: they do not replace controls or simulate an accent. CSS.supports only confirms syntax acceptance, not the tinting of each part or its legibility.