Color codes

pdf, print version >  

Color codes

In monitors, colors are composed and displayed by a combination of 3 basic colors: Red, Green and Blue.
Colors are therefore expressed by there RGB values. Each value ranges from 0 (darkest) to 255 (lightest). 
Thus, 255 x 255 x 255 = 16 million color possibilities called 32 bit color.
Example: a pure red is 255,0,0; a pure green is 0,255,0 and a pure blue is 0,0,255. 
A pure black is 0,0,0 where a pure white is 255,255,255.  
When there is the same value for all tree color components, the result will be a shade of gray. 
Example: 120, 120, 120 is a medium shade of gray.

Since Web browsers cannot interpret the RGB color code values, a different way of expressing the color value was devised called HEX value.
HEX values are expressed in the same sequence as the RGB values, meaning the first 2 digit expresses the Red value, the second 2 digits, the Green value and the last 2 digits the Blue value. This signifies that for each of the 255 color shades there exists an equivalent HEX value expressed in a combination of 2 digits.
RGB 0 = Hex 00,  RGB 255 = Hex FF.
Example : a pure red is FF0000; a pure green is 00FF00 and a pure blue is 0000FF. 
A pure black is 000000 where a pure white is FFFFFF.  
When there is the same value for all tree color components, the result will be a shade of gray. 
Example: 808080 is a medium shade of gray. See table below for RGB to HEX equivalencies.

But not all Web browsers support all colors. Depending on the version, they will either support 216, 4096 or 65,336 colors.

216 Web safe colors

text

4096 Web colors

In this color combination, the hex components for Red, Green & Blue use the following values: 00, 11, 22, 33, 44, 55, 66, 77, 88, 99, AA, BB, CC, DD, EE, FF.
The total number of color combinations, 16 x 16 x 16 = 4096, includes the 216 colors in the web palette. Digit pairs are used.
CSS style sheets allow each pair to be abbreviated to a single digit. 

16-bit - 65,536 colors

By end of 2003, less than 2% of the internet population were using 256 color mode, but a significant proportion are still using 16 bit color mode ( High Color ). There is a range of pale colors which change dramatically in 256 color mode, but outside that range the color shift is not too bad. Sixteen bit values are divided into Red, Green & Blue components

On Microsoft Windows systems, the first increment from zero is a double step. Red & Blue increment in steps of 8, and Green increments in steps of 4 ( hex: 16, 08, 16 ). The final value is set to FF.

How to use the color selector

In the table below, the horizontal value in red represents the first HEX code: for red,
the vertical value in green represents the second HEX code: for green 
and the bottom value represents the last HEX code: for blue.

Color mode detected as:

   
Red Green Blue
RGB
HEX
5 bits = 32 values  6 bits = 64 values  5 bits = 32 values 
32  x  64  x  32  =  65,536 colors
 
F0 C0 90 60 30 00 00 30 60 90 C0 F0 F0 C0 90 60 30 00 00 30 60 90 C0 F0 F0 C0 90 60 30 00 00 30 60 90 C0 F0
00                                                                                                                                                                                                                         00
30                                                                                                                                                                                                                         30
60                                                                                                                                                                                                                         60
90                                                                                                                                                                                                                         90
C0                                                                                                                                                                                                                         C0
F0                                                                                                                                                                                                                         F0
F0 C0 90 60 30 00
Safe pale colors

If all three RGB values are "F9", or higher, most browsers will use white in 256 color mode. Internet Explorer for Windows also uses pale gray ( F8 F8 F8 ) in 256 color mode.

F9F9FF  F9FFFF 
FFF9F9  FFF9FF 
F9FFF9  FFFFF9 
F9F9F9  FFFFFF 
Unsafe pale colors

In 16 bit mode ( High Color ) colors can be approximated with a 'dither' pattern. In 256 color mode most of the colors will change to the nearest Web safe color, but the 56 lightest colors are unsafe. There are 256 possible alternative colors, not just the 216 colors in the web palette. Microsoft Windows has 32 grayscale shades in its 256 color palette.

The table shows 64 color combinations using only hex components CC, DD, EE, FF. The eight colors marked with circles are web palette colors. Each browser uses a different selection of substitute colors for the remaining 56.

If all three RGB components are above "DC" hex ( 220 decimal ) the color will be "unsafe" in 256 color mode. In this range each browser uses different substitute colors.

 

 

FF

EE

DD

CC

CC

DD

EE

FF

FF

EE

DD

CC

CC

DD

EE

FF

CC

O

O

O

O

CC

DD

DD
EE EE
FF O O O O FF
FF EE DD CC

RGB to HEX equivalents

RGB

HEX

RGB

HEX

RGB

HEX

RGB

HEX

RGB

HEX

00

00

50

32

100

64

150

96

200

C8

01

01

51

33

101

65

151

97

201

C9

02

02

52

34

102

66

152

98

202

CA

03

03

53

35

103

67

153

99

203

CB

04

04

54

36

104

68

154

9A

204

CC

05

05

55

37

105

69

155

9B

205

CD

06

06

56

38

106

6A

156

9C

206

CE

07

07

57

39

107

6B

157

9D

207

CF

08

08

58

3A

108

6C

158

9E

208

D0

09

09

59

3B

109

6D

159

9F

209

D1

10

0A

60

3C

110

6E

160

A0

210

D2

11

0B

61

3D

111

6F

161

A1

211

D3

12

0C

62

3E

112

70

162

A2

212

D4

13

0D

63

3F

113

71

163

A3

213

D5

14

0E

64

40

114

72

164

A4

214

D6

15

0F

65

41

115

73

165

A5

215

D7

16

10

66

42

116

74

166

A6

216

D8

17

11

67

43

117

75

167

A7

217

D9

18

12

68

44

118

76

168

A8

218

DA

19

13

69

45

119

77

169

A9

219

DB

20

14

70

46

120

78

170

AA

220

DC

21

15

71

47

121

79

171

AB

221

DD

22

16

72

48

122

7A

172

AC

222

DE

23

17

73

49

123

7B

173

AD

223

DF

24

18

74

4A

124

7C

174

AE

224

E0

25

19

75

4B

125

7D

175

AF

225

E1

26

1A

76

4C

126

7E

176

B0

226

E2

27

1B

77

4D

127

7F

177

B1

227

E3

28

1C

78

4E

128

80

178

B2

228

E4

29

1D

79

4F

129

81

179

B3

229

E5

30

1E

80

50

130

82

180

B4

230

E6

31

1F

81

51

131

83

181

B5

231

E7

32

20

82

52

132

84

182

B6

232

E8

33

21

83

53

133

85

183

B7

233

E9

34

22

84

54

134

86

184

B8

234

EA

35

23

85

55

135

87

185

B9

235

EB

36

24

86

56

136

88

186

BA

236

EC

37

25

87

57

137

89

187

BB

237

ED

38

26

88

58

138

8A

188

BC

238

EE

39

27

89

59

139

8B

189

BD

239

EF

40

28

90

5A

140

8C

190

BE

240

F0

41

29

91

5B

141

8D

191

BF

241

F1

42

2A

92

5C

142

8E

192

C0

242

F2

43

2B

93

5D

143

8F

193

C1

243

F3

44

2C

94

5E

144

90

194

C2

244

F4

45

2D

95

5F

145

91

195

C3

245

F5

46

2E

96

60

146

92

196

C4

246

F6

47

2F

97

61

147

93

197

C5

247

F7

48

30

98

62

148

94

198

C6

248

F8

49

31

99

63

149

95

199

C7

249

F9

250

FA

251

FB

252

FC

253

FD

254

FE

255

FF

All rights reserved © Practical Group