MDN self-hosted library · e01.org

`accent-color` CSS property

The accent-color CSS property sets the accent color for user-interface controls generated by some elements.

no runnable cells css-property upstream source

The accent-color CSS property sets the accent color for user-interface controls generated by some elements.

CSS Demo: accent-color

```css interactive-example-choice accent-color: red;


```css interactive-example-choice
accent-color: #74992e;

```css interactive-example-choice accent-color: rgb(255 255 128);


```css interactive-example-choice
accent-color: hsl(250 100% 34%);

```html interactive-example


```css interactive-example
.container > div {
  display: flex;
  align-items: center;
}

#example-element {
  width: 40px;
  height: 40px;
}

#example-label {
  margin-left: 10px;
  font-size: x-large;
}

Syntax

/* Keyword value */
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

Formal syntax

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

500

Specifications

Browser compatibility

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