whatwg / whatwg.org

The WHATWG website and other static resources
https://whatwg.org/
Other
75 stars 50 forks source link

Consolidate colors #394

Open domenic opened 2 years ago

domenic commented 2 years ago

@hidde has been doing some great work to improve our color contrast. However it required updating lots of separately-declared colors in different files.

It'd be nice if the colors were centralized somewhere, and you could just change them in one place!

Ideas:

  1. Use a centralized CSS file with all the colors stored in CSS variables, and update all other CSS files to reference those CSS variables. Either @import it or add <link> tags into all the templates.
  2. (1), but add some build process that inlines it or does build-time variable substitution, so as to avoid extra HTTP requests.
  3. Try to figure out something that doesn't involve any new files, i.e., reduce the duplication but probably still have some. For example we could make sure all specs share the same colors by putting CSS variables into standard-shared-with-dev.css, and then, for example, standard.css, and HTML's specific styles, could reference those variables. But we would probably still need duplicated definitions in whatwg.org/style/subpages.css since there's no shared stylesheet between the spec and webpage styles, currently.

(3) seems like a pretty easy starting point.