Jump to content

Naming Custom Colors


jwcane

Recommended Posts

If it is possible to assign a unique name to a custom color on a style sheet, would like to see an example.n Thanks.

 

Link to comment
Share on other sites

CSS doesn't have any functionality like that. I would recommend using only the basic color names and use color codes for everything else. I don't trust that color names like "Aquamarine" or "LawnGreen" will always work.

 

Standard color names according to W3Schools.

aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.

Link to comment
Share on other sites

I am not familiar with any way to do that, although you can certainly add a /*comment*/ to remember what color it is, and I do that regularly. I think there is an proposed CSS3 way to create variables -- but it is not yet real.

 

http://dev.w3.org/csswg/css-variables/

 

https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables

Link to comment
Share on other sites

Thanks Dave, and I'm doing the comments already. It works ok, but variables will be welcome.

Link to comment
Share on other sites

Don't use specific class name for a specific colour, cause if you have to change it! to latest fashionable colour (purple becomes the new red) you will have to change the class name, or cause confusion.

 

.fontstyle01{color: red;}

 

.fontstyle01{color: purple;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...