I'd give them semantic names (like you have here), but use those semantic variables to reference the .bg-mallard or whatever - so in "use" you're only using .bg-primary-brand, but the base primitive color is .bg-mallard so you have a name to reference against a style guide Answer from OrtizDupri on reddit.com
MDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ CSS โบ Reference โบ Values โบ named-color
<named-color> - CSS | MDN - Mozilla
January 19, 2026 - The <named-color> CSS data type is the name of a color, such as red, blue, black, or lightseagreen.
W3Schools
w3schools.com โบ cssref โบ css_colors.php
CSS Colors
All modern browsers support the following 140 color names (click on a color name, or a hex value, to view the color as the background-color along with different text colors): For a full overview of CSS colors, visit our colors tutorial.
Videos
MDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ CSS โบ named-color
<named-color> - CSS - MDN Web Docs - Mozilla
The <named-color> CSS data type is the name of a color, such as red, blue, black, or lightseagreen.
147 Colors
147colors.com
147 Colors Grid - CSS Color Names
A tool for web designers and developers to learn the 147+ CSS color names that are available today.
RapidTables
rapidtables.com โบ web โบ css โบ css-color.html
CSS color codes & names
CSS color codes and names.
Reddit
reddit.com โบ r/web_design โบ how would name these colors in the css?
r/web_design on Reddit: How would name these colors in the CSS?
March 24, 2024 -
I'm trying to figure out what the best naming conventions are for the color palette below. I'm doing a bit over an overhaul to the CSS and want to future-proof it. I currently have them named by their color name, for example #006552 is .bg--mallard. However, this is turning out to be a bit of a problem when I need to change a color. Basically it results in having to update the class name in multiple files so I'm looking to name them something more abstract.
I've read it's better to name them based on their meaning or purpose, something like:
bg--primary-brand
bg--primary-brand-2
bg--secondary-1
bg--secondary-2
bg--secondary-3
bg--accent-1
etc...
Are there any tried and true methods I should be looking into? Thanks.
Top answer 1 of 5
2
I'd give them semantic names (like you have here), but use those semantic variables to reference the .bg-mallard or whatever - so in "use" you're only using .bg-primary-brand, but the base primitive color is .bg-mallard so you have a name to reference against a style guide
2 of 5
2
I don't think there's a "one fits all" solution, as it always kinda depends on both your design system as well as the technicalities of the project. For example, when I make a web project that has multiple themes (e.g. light and dark mode), my color variables are usually completely detached from the design system and are purely based on how the color/variable will be used. In such a project, I would have variables like: --text-primary --text-secondary --text-negative --background-primary --background-secondary --accent --accent-dark --accent-light Because when working with multiple themes, I find it important to know what elements are affected by each variable. But your project might not be a web app and you are working with a lot of colors, and we're not even not even talking about shades yet (which you usually need e.g. for hover states). When working with such a complex design system, it might make more sense to bring it into your CSS directly and potentially assign it to a variable named after it's intended usage. Here's just my idea of what I would probably do with this: I'm using SASS (and I'd highly recommend it to anyone), so I'd have a colors.scss file where everything color-related is managed. First, I would define the colors as SCSS variables and name them after the color, so $accent-magenta, $accent-orange and so on, and also include shades like $accent-orange-light (if the design system doesn't define shades, you can use SASS to scale the color). These variables will not be used outside of this file. Instead, I would use them to define CSS-variables that are once named after their intended purpose. That would result in variables like: --button-primary: $accent-orange; --button-primary-hover: $accent-orange-light; --button-primary-text: $neutral-light; --text-primary: $neutral-dark; --text-secondary: $neutral-medium; --navbar-background: $primary-lightgreen; --navbar-text: $neutral-light; and so on. So outside of the colors.scss file, you would only use the CSS-variables that are detached from the color and named after their application. In the colors.scss, you assign each application one of the colors. One color may also be used for multiple applications. This way, you don't need to worry about color names in your CSS while still having access to your whole design system. But as I said, that's all just how I would do it and I can't promise it will work for you.
W3Schools
w3schools.sinsixx.com โบ css โบ css_colornames.asp.htm
CSS Color Names - SinSiXX - W3Schools
Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building.
Quackit
quackit.com โบ css โบ css_color_codes.cfm
CSS Color Codes
Use the following color picker or color charts to pick a color that you can use within your CSS code. The color picker provides the color values in hexadecimal and RGB. The color chart provides them in hexadecimal, RGB, and their color names.
Quackit
quackit.com โบ css โบ color โบ charts โบ css_color_names_chart.cfm
CSS Color Names Chart
Full list of the official CSS named colors. Includes the equivalent RGB hex and decimal codes.
W3C
w3.org โบ wiki โบ CSS โบ Properties โบ color โบ keywords
CSS/Properties/color/keywords - W3C Wiki
ThreeDShadow The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border. Window Window background. WindowFrame Window frame. WindowText Text in windows. Retrieved from "https://www.w3.org/wiki/index.php?title=CSS/Properties/color/keywords&oldid=52690"
DoFactory
dofactory.com โบ css โบ color-names
CSS Color Names
CSS solor names are constant color values such as, red, purple, and teal. Color names can be used as color values in HTML and CSS. The same color names are also used by WPF and Silverlight. All modern browsers support 140 color names.
Prince
princexml.com โบ doc โบ 15 โบ css-color-names
Color Names ยท Prince Documentation
CSS offers several ways of defining colors - either by keyword, or by numerical specification expressed as RGB(A), CMYK, HSL(A), or HWB colors. For more details, please see the chapter on Color. Color keywords are an easy way of expressing colors by naming them. The names resolve to colors in sRGB.
W3Schools
w3schools.com โบ tags โบ ref_colornames.asp
HTML Color Names
All modern browsers support the ... a color name, or a hex value, to view the color as the background-color along with different text colors): For a full overview of HTML colors, visit our colors tutorial. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ยท If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com ยท HTML Tutorial CSS Tutorial ...
Ditig
ditig.com โบ css-named-colors
CSS named colors - Ditig
April 18, 2025 - Contains a list of all CSS Color Module Level 4 named colors โ listed with hex, RGB, and HSL values.
Ado
ado.xyz โบ blog โบ custom-css-color-names
How to Create Custom CSS Named Colors - Ado.xyz
March 25, 2021 - In an earlier post, we looked at Named Colors in CSS. Currently there are 147 named CSS colors that you can use, ranging from primary colors like red, green, and blue, to more exotic choices like tomato, aquamarine, and mediumslateblue. But what if you want to have your own named CSS colors?
Chirag Mehta
chir.ag โบ projects โบ name-that-color
Name that Color - Chirag Mehta : chir.ag
Being a typical guy, I have no clue what the colors Lavender and Mauve look like. You can show me Indigo and I won't know if it's more like Violet or Purple. So I made this little app where you can create a color on the screen (or copy-paste CSS hex# color) and find out the name of the closest matching color.
CSS Portal
cssportal.com โบ css-color-names
CSS Color Names - CSS Portal
A complete CSS color names list with samples, HEX codes and RGB values - perfect for finding and choosing colors in your web projects.