The Firefox user agent styles are available locally in Firefox at…

resource://gre-resources/

(mostly but not entirely in the html.css file)

Is there a similar way to access those files in webkit/chromium browsers? I have the links to the source code already.

@mia
Where are the colors? In ua.css, there are a few hex values for print-related pseudo-elements, a few color keywords, and system color keywords like `color: CanvasText;` but I didn't find a file that gave actual color values for the system color keywords for light or dark modes.

@cwilcox808 The browser styles only include the actual CSS being declared, and not instructions for resolving/rendering CSS values in context. Those styles still need to cascade with ours, which also might include things like `CanvasText` or `CurrentColor` that resolve contextually.

Actually getting the 'used' value out of them happens later, while laying out the page, and is probably defined deep in some browser engine C/Swift/Rust code somewhere.

https://www.w3.org/TR/css-cascade-5/#used

CSS Cascading and Inheritance Level 5

@cwilcox808 But I haven't looked for specifically where system colors are defined in any given browser. That's something @emilio or @andreu might be able to point to.

@mia @cwilcox808 @emilio @andreu they sometimes come from the OS too so not something that's fully hardcoded.

Here's the default values in chromium though:
https://source.chromium.org/chromium/chromium/src/+/main:ui/color/color_provider_utils.cc;l=553

@mia @cwilcox808 @andreu

If you're curious, in Firefox it starts around here: https://searchfox.org/firefox-main/rev/a729ef7f53b9b53b4cb6651b16618c462c8f0674/layout/style/GeckoBindings.cpp#749

Depending on the color name and settings (effective color-scheme, forced-colors, printing, ...) it might end up in a list of hard-coded "stand-ins" list, in a user pref value, or in the OS color (NativeGetColor): https://searchfox.org/firefox-main/rev/a729ef7f53b9b53b4cb6651b16618c462c8f0674/widget/nsXPLookAndFeel.cpp#1009-1022

GeckoBindings.cpp - mozsearch

@emilio @mia @cwilcox808 @andreu So, are we going to put all this stuff in a non-normative appendix of CSS Color 4?
Not clear if it ads value, or just becomes progressively outdated over time.
@svgeesus @emilio @cwilcox808 @andreu I don't know that it needs to move from browser to spec, unless there is a shared answer - but getting back to my initial question, I'd be excited about browsers making these things easily discoverable