Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Colors and Backgrounds

The accent-color property

Reference for the CSS accent-color property: recolor checkboxes, radio buttons, range sliders and progress bars without rebuilding them, with examples.

The accent-color property sets the highlight color of built-in form controls: the checked state of checkboxes and radio buttons, the filled part of a range slider, and the bar of a <progress> element. The control keeps its native look, behavior and accessibility; only the main color changes.

The browser chooses a readable color for anything drawn on top of your accent, such as the check mark, so you do not have to worry about contrast for that part.

CSS
input[type="checkbox"] {
  accent-color: #7c3aed;
}

Try it

Accent colors on native controls

Because accent-color inherits, setting it on a wrapper (here, each row) colors every supported control inside.

Syntax

CSS
accent-color: auto | <color>
  • Initial value: auto
  • Applies to: all elements (it has an effect on checkboxes, radio buttons, range inputs and <progress>)
  • Inherited: yes
  • Animatable: yes, as a color
  • Computed value: auto, or the computed color

Values

Value Description
auto Uses the browser or operating system default accent color.
<color> Any CSS color: a keyword, hex value, rgb(), oklch() and so on. See color values.

Usage notes

  • The cheapest way to brand a form. One declaration on :root or body recolors every checkbox, radio, range and progress bar, with no custom markup and no loss of keyboard or screen reader support.
  • Which controls are affected can differ slightly between browsers. Text fields, selects and buttons are not recolored by this property. Use appearance and your own styles when you need full control.
  • Keep contrast in mind. The accent is drawn against the page background and the unchecked track. A very pale accent on a white page can make the checked state hard to see.
  • It follows the color scheme. In a dark scheme (see color-scheme) the browser adapts the surrounding parts of the control to the accent.
  • Pairs well with caret-color. Setting both gives text inputs and toggles one consistent highlight.
  • It does not change focus rings. Use outline for those.

Browser support

Supported in current versions of all major browsers and part of Baseline; check a compatibility table for older releases.