CSS accent-color Property
The accent-color property sets the accent color used by certain native form controls.
It allows checkboxes, radio buttons, range sliders, and progress bars to use a custom accent color while retaining their browser-provided appearance and functionality.
accent-color Syntax
selector {
accent-color: auto | color;
}
Replace color with a valid CSS color value, such as a named color, hexadecimal value, or color function. The auto keyword allows the browser to choose the accent color.
The property also accepts the global CSS values inherit, initial, revert, revert-layer, and unset.
Property Values
| Value | Description |
|---|---|
auto |
Allows the browser to determine the accent color. This is the initial value. |
<color> |
Specifies the accent color using a valid CSS color value. |
inherit |
Uses the computed accent color of the parent element. |
initial |
Resets the property to its initial value, auto. |
unset |
Uses the inherited value because accent-color is an inherited property. |
The default value is auto. The property is inherited, so a color assigned to a form or container can affect supported controls inside it.
How accent-color Works
Browsers normally choose the accent colors of native form controls. The accent-color property allows you to supply a preferred color without replacing the controls with custom graphics or removing their native appearance.
input {
accent-color: #1769aa;
}
This rule applies a blue accent color to supported input controls. Other input types, such as text fields, are not affected by the property.
The browser determines how the accent color is used within each control. The exact appearance, including surrounding colors and contrast adjustments, can vary between browsers and operating systems.
Supported Form Controls
The accent-color property applies to native user-interface controls that support an accent color.
| Control | Effect |
|---|---|
input[type="checkbox"] |
Changes the accent color of the checkbox, typically when checked. |
input[type="radio"] |
Changes the accent color of the selected radio button. |
input[type="range"] |
Changes the accent color used by the slider's native appearance. |
progress |
Changes the accent color of the progress indicator. |
The property does not apply a general background or text color to all form controls. Use properties such as color, background-color, and border-color when those aspects need separate styling.
accent-color Example
The following example assigns different accent colors to checkboxes, radio buttons, a range slider, and a progress bar.
<label>
<input type="checkbox" class="blue-accent" checked>
Blue checkbox
</label>
<label>
<input type="radio" name="accent-demo" class="green-accent" checked>
Green radio button
</label>
<label for="accent-range">Range slider:</label>
<input type="range" id="accent-range" class="purple-accent" value="65">
<label for="accent-progress">Progress:</label>
<progress id="accent-progress" class="orange-accent" value="70" max="100">70%</progress>
.blue-accent {
accent-color: #1769aa;
}
.green-accent {
accent-color: #198754;
}
.purple-accent {
accent-color: #7952b3;
}
.orange-accent {
accent-color: #c75b12;
}
Each control uses its assigned accent color where supported. You can interact with the controls below to see how the browser displays the selected colors.
Because the controls retain their native appearance, their visual details may differ across browsers.
Accessibility Considerations
Native form controls retain their built-in behavior when styled with accent-color. This makes the property a useful alternative to completely replacing their appearance with custom controls.
Choose accent colors that remain distinguishable against surrounding colors. Check both light and dark color schemes, and do not rely on color alone to communicate important information.
Browsers may adjust parts of a control's appearance to maintain contrast, but the result should still be tested for readability and usability.
Browser Support
The accent-color property is widely available in modern browsers, including Chrome, Edge, Firefox, and Safari. The exact appearance of supported controls can vary by browser and operating system.
Visit Can I Use? for current browser compatibility information.
Specifications
The accent-color property is defined in the CSS Basic User Interface Module Level 4 specification.
