CSS colors

来源:互联网 发布:php中单例模式 编辑:程序博客网 时间:2024/05/16 06:57

Colors are displayed combining RED, GREEN, and BLUE light.


 

Color Values

CSS colors are defined using a hexadecimal (hex) notation for the combination of Red, Green, and Blue color values (RGB). The lowest value that can be given to one of the light sources is 0 (hex 00). The highest value is 255 (hex FF).

Hex values are written as 3 double digit numbers, starting with a # sign.

Color Examples

ColorColor HEXColor RGB#000000rgb(0,0,0) #FF0000rgb(255,0,0) #00FF00rgb(0,255,0) #0000FFrgb(0,0,255) #FFFF00rgb(255,255,0) #00FFFFrgb(0,255,255) #FF00FFrgb(255,0,255) #C0C0C0rgb(192,192,192) #FFFFFFrgb(255,255,255)
Try it yourself »


 

16 Million Different Colors

The combination of Red, Green and Blue values from 0 to 255 gives a total of more than 16 million different colors to play with (256 x 256 x 256).

Most modern monitors are capable of displaying at least 16384 different colors.

If you look at the color table below, you will see the result of varying the red light from 0 to 255, while keeping the green and blue light at zero.

To see a full list of color mixes when the red light varies from 0 to 255, click on one of the hex or rgb values below.

Red LightHEXRGB #000000 rgb(0,0,0)  #080000 rgb(8,0,0)  #100000 rgb(16,0,0)  #180000 rgb(24,0,0)  #200000 rgb(32,0,0)  #280000 rgb(40,0,0)  #300000 rgb(48,0,0)  #380000 rgb(56,0,0)  #400000 rgb(64,0,0)  #480000 rgb(72,0,0)  #500000 rgb(80,0,0)  #580000 rgb(88,0,0)  #600000 rgb(96,0,0)  #680000 rgb(104,0,0)  #700000 rgb(112,0,0)  #780000 rgb(120,0,0)  #800000 rgb(128,0,0)  #880000 rgb(136,0,0)  #900000 rgb(144,0,0)  #980000 rgb(152,0,0)  #A00000 rgb(160,0,0)  #A80000 rgb(168,0,0)  #B00000 rgb(176,0,0)  #B80000 rgb(184,0,0)  #C00000 rgb(192,0,0)  #C80000 rgb(200,0,0)  #D00000 rgb(208,0,0)  #D80000 rgb(216,0,0)  #E00000 rgb(224,0,0)  #E80000 rgb(232,0,0)  #F00000 rgb(240,0,0)  #F80000 rgb(248,0,0)  #FF0000 rgb(255,0,0) 


 

Shades of Gray

Gray colors are displayed using an equal amount of power to all of the light sources. To make it easier for you to select the right gray color we have compiled a table of gray shades for you:

Gray ShadesHEXRGB #000000 rgb(0,0,0)  #080808 rgb(8,8,8)  #101010 rgb(16,16,16)  #181818 rgb(24,24,24)  #202020 rgb(32,32,32)  #282828 rgb(40,40,40)  #303030 rgb(48,48,48)  #383838 rgb(56,56,56)  #404040 rgb(64,64,64)  #484848 rgb(72,72,72)  #505050 rgb(80,80,80)  #585858 rgb(88,88,88)  #606060 rgb(96,96,96)  #686868 rgb(104,104,104)  #707070 rgb(112,112,112)  #787878 rgb(120,120,120)  #808080 rgb(128,128,128)  #888888 rgb(136,136,136)  #909090 rgb(144,144,144)  #989898 rgb(152,152,152)  #A0A0A0 rgb(160,160,160)  #A8A8A8 rgb(168,168,168)  #B0B0B0 rgb(176,176,176)  #B8B8B8 rgb(184,184,184)  #C0C0C0 rgb(192,192,192)  #C8C8C8 rgb(200,200,200)  #D0D0D0 rgb(208,208,208)  #D8D8D8 rgb(216,216,216)  #E0E0E0 rgb(224,224,224)  #E8E8E8 rgb(232,232,232)  #F0F0F0 rgb(240,240,240)  #F8F8F8 rgb(248,248,248)  #FFFFFF rgb(255,255,255) 


 

Web Safe Colors?

Some years ago, when computers supported max 256 different colors, a list of 216 "Web Safe Colors" was suggested as a Web standard, reserving 40 fixed system colors.

This is not important now, since most computers can display millions of different colors, but the choice is left to you.

The 216 cross-browser color palette was created to ensure that all computers would display the colors correctly when running a 256 color palette:

0000000000330000660000990000CC0000FF0033000033330033660033990033CC0033FF0066000066330066660066990066CC0066FF0099000099330099660099990099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF0000FF3300FF6600FF9900FFCC00FFFF3300003300333300663300993300CC3300FF3333003333333333663333993333CC3333FF3366003366333366663366993366CC3366FF3399003399333399663399993399CC3399FF33CC0033CC3333CC6633CC9933CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF6600006600336600666600996600CC6600FF6633006633336633666633996633CC6633FF6666006666336666666666996666CC6666FF6699006699336699666699996699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066FF3366FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF9933009933339933669933999933CC9933FF9966009966339966669966999966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC3399CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFFCC0000CC0033CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFFCCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0000FF0033FF0066FF0099FF00CCFF00FFFF3300FF3333FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFFFFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF

原创粉丝点击