`accent-color` CSS property
Baseline Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The accent-color CSS property sets the accent color for user-interface controls generated by some elements.
Try it
accent-color: red;
accent-color: #74992e;
accent-color: rgb(255 255 128);
accent-color: hsl(250 100% 34%);
<section class="default-example container" id="default-example">
<div>
<input checked id="example-element" type="checkbox" />
<label for="example-element" id="example-label">Example Label</label>
</div>
</section>
.container > div {
display: flex;
align-items: center;
}
#example-element {
width: 40px;
height: 40px;
}
#example-label {
margin-left: 10px;
font-size: x-large;
}
Syntax
/* Keyword values */ accent-color: auto; /* <color> values */ accent-color: darkred; accent-color: #5729e9; accent-color: rgb(0 200 0); accent-color: hsl(228 4% 24%); /* Global values */ accent-color: inherit; accent-color: initial; accent-color: revert; accent-color: revert-layer; accent-color: unset;
Values
This property is specified as the keyword auto or one <color> value:
-
auto - Represents a UA-chosen color, which should match the accent color of the platform, if any.
-
color - Specifies the color to be used as the accent color.
Description
Browsers that support accent-color currently apply it to the following HTML elements:
Each user agent has an accent color, with variations to ensure legibility and contrast. That accent color is not used by every user-interface control nor in every state of the control. The accent-color is only applied to user-interface controls that use an accent color in the states where it is applicable.
Note: To reduce the risk of fingerprinting, some browsers return a fixed value for accent-color: auto unless it is used in certain restricted circumstances. See browser compatibility for details.
Formal definition
| Initial value | auto |
|---|---|
| Applies to | all elements |
| Inherited | yes |
| Computed value | <code>auto</code> is computed as specified and <code><color></code> values are computed as defined for the color property. |
| Animation type | by computed value type |
Formal syntax
accent-color = auto | <color> <color> = <color-base> | currentColor | <system-color> | <light-dark()> | <deprecated-system-color> <color-base> = <hex-color> | <color-function> | <named-color> | <color-mix()> | transparent <system-color> = AccentColor | AccentColorText | ActiveText | ButtonBorder | ButtonFace | ButtonText | Canvas | CanvasText | Field | FieldText | GrayText | Highlight | HighlightText | LinkText | Mark | MarkText | SelectedItem | SelectedItemText | VisitedText <light-dark()> = light-dark( <color>, <color> ) <deprecated-system-color> = ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonHighlight | ButtonShadow | CaptionText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText <color-function> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <lab()> | <lch()> | <oklab()> | <oklch()> | <color()> <named-color> = aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen <color-mix()> = color-mix( <color-interpolation-method> , [ <color> && <percentage [0,100]>? ]#{2}) <rgb()> = rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? ) | rgb( [ <number> | <percentage> | none ]{3} [ / [ <alpha-value> | none ] ]? ) <rgba()> = rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? ) | rgba( [ <number> | <percentage> | none ]{3} [ / [ <alpha-value> | none ] ]? ) <hsl()> = hsl( <hue>, <percentage>, <percentage>, <alpha-value>? ) | hsl( [ <hue> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? ) <hsla()> = hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ) | hsla( [ <hue> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? ) <hwb()> = hwb( [ <hue> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? ) <lab()> = lab( [<percentage> | <number> | none] [ <percentage> | <number> | none] [ <percentage> | <number> | none] [ / [<alpha-value> | none] ]? ) <lch()> = lch( [<percentage> | <number> | none] [ <percentage> | <number> | none] [ <hue> | none] [ / [<alpha-value> | none] ]? ) <oklab()> = oklab( [ <percentage> | <number> | none] [ <percentage> | <number> | none] [ <percentage> | <number> | none] [ / [<alpha-value> | none] ]? ) <oklch()> = oklch( [ <percentage> | <number> | none] [ <percentage> | <number> | none] [ <hue> | none] [ / [<alpha-value> | none] ]? ) <color()> = color( [ from <color> ]? <colorspace-params> [ / [ <alpha-value> | none ] ]? ) <color-interpolation-method> = in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? | <custom-color-space> ] <alpha-value> = <number> | <percentage> <hue> = <number> | <angle> <colorspace-params> = [<custom-params> | <predefined-rgb-params> | <xyz-params>] <rectangular-color-space> = srgb | srgb-linear | display-p3 | display-p3-linear | a98-rgb | prophoto-rgb | rec2020 | lab | oklab | xyz | xyz-d50 | xyz-d65 <polar-color-space> = hsl | hwb | lch | oklch <hue-interpolation-method> = [ shorter | longer | increasing | decreasing ] hue <custom-color-space> = <dashed-ident> <custom-params> = <dashed-ident> [ <number> | <percentage> | none ]+ <predefined-rgb-params> = <predefined-rgb> [ <number> | <percentage> | none ]{3} <xyz-params> = <xyz> [ <number> | <percentage> | none ]{3} <predefined-rgb> = srgb | srgb-linear | display-p3 | display-p3-linear | a98-rgb | prophoto-rgb | rec2020 <xyz> = xyz | xyz-d50 | xyz-d65
Examples
Setting a custom accent color
HTML
<input type="checkbox" checked /> <input type="checkbox" class="custom" checked />
CSS
input {
accent-color: auto;
display: block;
width: 30px;
height: 30px;
}
input.custom {
accent-color: rebeccapurple;
}
Result
Specifications
| Specification |
|---|
| CSS Basic User Interface Module Level 4 # widget-accent |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | WebView Android | WebView on iOS | |
accent-color |
93 |
93 |
92 |
79 |
26.2
15.4–26.2Safari does not maintain minimum contrast for legibility of the control. See bug 244233. |
93Chrome for Android does not maintain minimum contrast for legibility of the control. See bug 343503163. |
92 |
66Chrome for Android does not maintain minimum contrast for legibility of the control. See bug 343503163. |
26.2
15.4–26.2Safari on iOS does not maintain minimum contrast for legibility of the control. See bug 244233. |
17.0Chrome for Android does not maintain minimum contrast for legibility of the control. See bug 343503163. |
93Chrome for Android does not maintain minimum contrast for legibility of the control. See bug 343503163. |
26.2
15.4–26.2WebView on iOS does not maintain minimum contrast for legibility of the control. See bug 244233. |
auto |
93From version 149, to mitigate fingerprinting risks, a fixed value is returned foraccent-color: auto unless used within installed web apps on a user's initial profile. |
93From version 149, to mitigate fingerprinting risks, a fixed value is returned foraccent-color: auto unless used within installed web apps on a user's initial profile. |
92 |
79From version 133, to mitigate fingerprinting risks, a fixed value is returned foraccent-color: auto unless used within installed web apps on a user's initial profile. |
15.4 |
93 |
92 |
66 |
15.4 |
17.0 |
93 |
15.4 |
currentColor |
93 |
93 |
92 |
79 |
15.4 |
93 |
92 |
66 |
15.4 |
17.0 |
93 |
15.4 |
transparent |
93 |
93 |
92 |
79 |
15.4 |
93 |
92 |
66 |
15.4 |
17.0 |
93 |
15.4 |
See also
-
background-color,border-color,caret-color,color,column-rule-color,outline-color,text-decoration-color,text-emphasis-color,text-shadow: Other color-related properties -
color: Related data type -
<input>: Related HTML element
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/accent-color