Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

accent-color — accent color for native controls

`accent-color` inherits a `<color>` and supplies it to those parts of user-interface controls that the platform draws with an accent.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

auto | <color>

accent-color inherits a <color> and supplies it to those parts of user-interface controls that the platform draws with an accent.

Real checkbox and progress elements inherit rgb(220, 0, 0), while the range overrides it with rgb(0, 80, 220); forced-color mode is false. The example uses checked/value states on controls, not an unrelated div.

Grammar: auto | <color>.

Common targets include checkbox, radio, range, and progress, but exact parts and states are UA-dependent; auto selects the platform color. The UA may adjust brightness or glyph colors to retain contrast. Partly transparent rgb(255 0 0 / 50%) is first composited over system Canvas into an opaque accent, and forced-colors can override the author. The property applies to all elements, but does not paint ordinary box backgrounds by itself.

Examples

const group=document.createElement('fieldset');group.style.accentColor='rgb(220, 0, 0)';
const checkbox=document.createElement('input');checkbox.type='checkbox';checkbox.checked=true;
const progress=document.createElement('progress');progress.max=1;progress.value=.6;
const range=document.createElement('input');range.type='range';range.value='40';range.style.accentColor='rgb(0, 80, 220)';
group.append(checkbox,progress,range);document.body.append(group);
const accent=node=>getComputedStyle(node).accentColor;
console.log('checkbox='+checkbox.checked+'/'+accent(checkbox)+'; progress='+progress.value+'/'+accent(progress)+'; range='+range.value+'/'+accent(range)+'; forced-colors='+matchMedia('(forced-colors: active)').matches);

Result

checkbox=true/rgb(220, 0, 0); progress=0.6/rgb(220, 0, 0); range=40/rgb(0, 80, 220); forced-colors=false

`accent-color` inherits a `<color>` and supplies it to those parts of user-interface controls that the platform draws with an accent.

Sources