brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: accent-color in css recolors checkboxes, radios and sliders in one line

Css
~/tips/tip-css-accent-color-form-controls

:root { accent-color: #0b6bcb; }

Colors the active part of native checkboxes, radio buttons and sliders with one declaration.

Custom checkboxes used to mean hiding the real input and drawing a fake one.

:root { accent-color: #0b6bcb; }
input[type="range"] { accent-color: #c2410c; }

accent-color tells the browser which color to use for the checked or active part of native controls: checkboxes, radio buttons, range sliders and progress bars. The control stays accessible and keeps its keyboard behaviour. The browser also picks a readable color for the tick inside a checkbox. It does not change other parts like the unchecked border or select menus, so for those you still need appearance: none and your own styling.

Further reading: MDN: accent-color

More Css tips CSS Overview in Chrome DevTools audits the colors and fonts of a page .notice:empty { .toast { article { counter-reset: h2; } .toolbar { All Css tips (66) All topics

Link