{"id":350365,"date":"2021-08-26T15:08:00","date_gmt":"2021-08-26T22:08:00","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=350365"},"modified":"2022-08-25T08:13:39","modified_gmt":"2022-08-25T15:13:39","slug":"accent-color","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/a\/accent-color\/","title":{"rendered":"accent-color"},"content":{"rendered":"\n

The accent-color<\/code> property in CSS is capable of re-tinting the accented color of form controls provided by the browser’s default styles with a custom color value.<\/p>\n\n\n\n

.element {\n  accent-color: #f8a100;\n}<\/code><\/pre>\n\n\n\n

accent-color<\/code> is defined in CSS Basic User Interface Module Level 4<\/a>, which is currently in Working Draft. That means the details are still a work in progress and could change between now and when the spec becomes a formal recommendation.<\/p>\n\n\n

Syntax<\/h3>\n\n\n
accent-color: auto | <color>;<\/code><\/pre>\n\n\n\n
  • Initial value:<\/strong> auto<\/li>
  • Applies to:<\/strong> all elements<\/li>
  • Inherited:<\/strong> yes<\/li>
  • Computed value:<\/strong> the keyword auto<\/code> or a computed color<\/li>
  • Animation type:<\/strong> by computed value type<\/li><\/ul>\n\n\n

    Values<\/h3>\n\n\n
    \/* Keyword *\/\naccent-color: auto;\n\n\/* <color> *\/\naccent-color: red;\naccent-color: #f8a100\naccent-color: rgba(102, 100, 70, 1);\naccent-color: hsla(180, 100%, 70%, 1);\n\n\/* Global*\/\naccent-color: inherit;\naccent-color: initial;\naccent-color: revert;\naccent-color: unset;<\/code><\/pre>\n\n\n

    Finally, an “easy” way to style forms!<\/h3>\n\n\n

    Styling forms has traditionally been… well, awful. No need to look further than customizing the <progress><\/code> element<\/a> to see just how difficult it is to style controls. What that generally leads to is a decision between accepting the browser’s default styles or a major lift to reset and recreate them from scratch.<\/p>\n\n\n\n

    Here’s what it usually takes to get a custom <progress><\/code> color:<\/p>\n\n\n\n