{"canonical_url":"https://engineer.company/glossary/forced-colors/","content_markdown":"# Forced colors\n\n## What it is\n\nForced colors is a mode in which the user agent applies a restricted colour\npalette chosen for the user's needs. It can override some colours supplied by a\npage so text, surfaces and controls use the platform's selected colours. In CSS,\na `(forced-colors: active)` media query lets authors make targeted adjustments\nwhen the browser applies this palette.\n\nThe browser chooses system colours based on the element and property. A page can\nalso use system colour keywords to describe the role it needs, such as\n`CanvasText` for text on the page canvas or `ButtonText` for the foreground of a\nbutton. Several forms of decorative paint can be reduced or removed. Check which\nparts of a component carried meaning and make sure those parts remain\ndistinguishable under the selected conditions.\n\nThe `forced-color-adjust` property lets authors opt out of automatic colour\nadjustment for particular elements. That creates a responsibility to keep those\nelements readable in the actual user palette. Use an opt-out narrowly where the\ncontent requires it and test it with meaningful colour choices. Native control\nsemantics and alternative states matter as much as pixel appearance in this\nmode.\n\n## Why it matters\n\nA design can rely on a subtle shadow or a tinted surface to describe where an\naction begins and ends. When the browser changes those colours, the label can\nremain readable while the button loses its visible boundary. A list can use fill\ncolours to mark which item is selected, and all items can appear similar after\nautomatic adjustment. The user still needs a way to recognise the action and its\nstate.\n\nForced-colour users can have different chosen palettes. A team should test more\nthan one representative setting, including dark and light system colours where\nthe environment supports them. A fix that manually declares a white stroke might\nlook clear in one palette and vanish in another. The useful distinction is\nusually the role of the stroke or text, which a system keyword can help express.\n\nCommon interaction feedback also needs attention. Focus, selection, disabled\nstate and an error signal should remain understandable. Shapes, labels and\noutlines can provide redundant evidence where colour changes. Begin with the\ntask the user needs to perform and preserve the parts of visual hierarchy that\nguide it.\n\n## What it looks like in practice\n\nImagine a menu with a selected item and a button that opens it. Load it with\nforced colours active and use the keyboard to reach the button. Look for a\nvisible boundary and focus indicator. Open the menu and look at the current\nselection, an unavailable item and the next focus target. Check what state the\nbrowser exposes as well as what the user can see.\n\nReview the properties that paint each part. A shadow may have made the surface\nvisible in the ordinary design. A border using an appropriate system colour can\nmake its edge visible in forced colours. An icon that follows the element's text\ncolour can continue to match the surrounding control. Test its meaning with its\naccessible name or label and check that it remains distinguishable against the\nbutton's background.\n\nEngineer's [site accessibility statement](/accessibility/) documents checks for\nvisible focus, names, contrast and the scope of its rendered evaluations. Those\nare useful starting points for a forced-colour exercise. The illustrative menu\ntest keeps the same action, names and order and adds observation with the user's\nrestricted palette. The result should say which component state and platform\nsetting produced the evidence.\n\nInclude text placed over a decorative background. The browser's adjustments can\nchange the relationship between that text and the image or surface behind it.\nCheck the complete result after the preference applies. A design can preserve\nthe intended reading order and use an explicit background where the page's\noriginal colours no longer provide the needed distinction.\n\n## Where it goes wrong\n\nA common mistake is to tune only ordinary light and dark themes. Forced colours\nchanges paint according to the user's system palette and browser rules. Inspect\nthe painted state while the system palette is active. Check important controls\nand boundaries under the preference independently of the choices made for other\ncolour schemes.\n\nAnother issue is undoing the browser's adjustments across a large region. A\nfixed palette can reduce readability for the person who selected the mode.\nChoose the smallest element that needs special handling and exercise it with the\nrelevant palettes. Keep ordinary controls aligned with the system roles where\nthey can use them.\n\nNative semantics can influence which role colours the browser chooses. A custom\nelement that looks like a button may be painted according to different defaults\nfrom a native button. Compare actual browser output for text, fill and border\nwhen reviewing a custom control. Preserve its role and name when adapting its\nvisual treatment, so the same interaction remains identifiable.\n\nAn automated browser can exercise a forced-colour preference and reveal missing\nboundaries quickly. A check on an actual platform palette can add evidence about\na user's chosen colours and system controls. Name which conditions were\nexercised. Re-test ordinary and forced palettes after changing a shared\ncomponent so a narrow fix stays attached to the state that needed it.\n\nFinally, track meaning that used to depend on a fill, gradient or shadow. A\nselected item can gain a clear indicator. A text label can make a status\nunderstandable even if the system palette changes its colour. Check long labels\nand constrained layouts as well as a clean sample. The feature works when the\nuser can identify the element, understand its state and complete the same task\nthrough the adjusted design.\n\n## Further reading\n\n- [W3C CSS Color Adjustment forced colours](https://www.w3.org/TR/css-color-adjust-1/#forced).\n  Specifies the user agent's adjustment model.\n- [W3C Media Queries forced-colors feature](https://www.w3.org/TR/mediaqueries-5/#forced-colors).\n  Defines how authors detect the active state.\n- [Mozilla's forced-colors documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/forced-colors).\n  Gives authoring examples and notes on affected properties.\n\n\u003chttps://engineer.company/glossary/forced-colors/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"Test links, borders, icons and focus indicators against the system palette used in forced colors mode.","formats":{"gemtext":"https://engineer.company/glossary/forced-colors/index.gmi","gopher":"https://engineer.company/glossary/forced-colors/gophermap","html":"https://engineer.company/glossary/forced-colors/","json":"https://engineer.company/glossary/forced-colors/index.json","markdown":"https://engineer.company/glossary/forced-colors/index.md","pdf":"https://engineer.company/glossary/forced-colors/index.pdf"},"kind":"page","language":"en","title":"What are forced colors?","url":"https://engineer.company/glossary/forced-colors/","version":1}