Jump to content

Naming Custom Colors


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 post
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 post
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 post
Share on other sites

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

Link to post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...