Jump to content
xisto Community
Sign in to follow this  
iGuest

colours

Recommended Posts

I've always used RGB colours (e.g #000000)^which is really easy to work out what a colour will look like from the numbers...how does hex work, and where is hex best used?

Share this post


Link to post
Share on other sites

hex is base 16 instead of base 101 = 12 = 2.......A = 10B = 11C = 12D = 13E = 14F = 15To count in Hex: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F etc...it is in factors of 16 and always has two digits 0f=15 1f=29

Share this post


Link to post
Share on other sites

This is the standard for Color in Cascading Style Sheets from w3.org

6.3    Color units
A color is a either a keyword or a numerical RGB specification.

The suggested list of keyword color names is: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. These 16 colors are taken from the Windows VGA palette, and their RGB values are not defined in this specification.

BODY {color: black; background: white }
H1 { color: maroon }
H2 { color: olive }

The RGB color model is being used in numerical color specifications. These examples all specify the same color:

EM { color: #f00 }              /* #rgb */
EM { color: #ff0000 }          /* #rrggbb */
EM { color: rgb(255,0,0) }      /* integer range 0 - 255 */
EM { color: rgb(100%, 0%, 0%) } /* float range 0.0% - 100.0% */

The format of an RGB value in hexadecimal notation is a '#' immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This makes sure that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.

The format of an RGB value in the functional notation is 'rgb(' followed by a comma-separated list of three numerical values (either three integer values in the range of 0-255, or three percentage values in the range of 0.0% to 100.0%) followed by ')'. Whitespace characters are allowed around the numerical values.

Values outside the numerical ranges should be clipped. The three rules below are therefore equivalent:

EM { color: rgb(255,0,0) }      /* integer range 0 - 255 */
EM { color: rgb(300,0,0) }      /* clipped to 255 */
EM { color: rgb(110%, 0%, 0%) }  /* clipped to 100% */

RGB colors are specified in the sRGB color space [9]


Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.