Web colors: Difference between revisions

Content deleted Content added
Undid revision 1304224930 by 189.68.158.71 (talk) not in cited source
 
Line 1:
{{short description|Color used in designing web pages}}
{{Use dmy dates|date=October 2014}}
{{Use American English|date=October 2020}}
{{Html series}}
'''Web colors''' are [[color]]s used in [[Web design|displaying web pages]] on the [[World Wide Web]]; they can be described by way of three methods: a color may be specified as an [[RGB color model|RGB]] triplet, in [[hexadecimal]] format (a ''hex triplet'') or according to its common English name in some cases. A [[color tool]] or other [[graphics software]] is often used to generate color values. In some uses, '''hexadecimal color''' codes are specified with notation using a leading [[number sign]] (#).<ref>{{cite book | last = Niederst Robbins | first = Jennifer | title = Web Design in a Nutshell | publisher = O'Reilly |date=February 2006 |page=830 | isbn = 978-0-596-00987-8 |chapter=Appendix D: Specifying Color }}</ref><ref>York, Richard. ''Beginning CSS'', pp. 71–72.</ref> A color is specified according to the intensity of its red, green and blue components, each represented by eight [[bit]]s. Thus, there are 24 bits used to specify a web color within the [[sRGB]] gamut, and 16,777,216 colors that may be so specified.
Authors of [[world wide web|web]] pages have a variety of options available for specifying [[color]]s for elements of web documents. Colors may be specified as an [[RGB]] triplet in [[hexadecimal]] format (a ''hex triplet''); they may also be specified according to their common [[English language|English]] names in some cases.
 
Colors outside the sRGB gamut can be specified in [[CSS|Cascading Style Sheets]] by making one or more of the red, green and blue components negative or greater than 100%, so the color space is theoretically an unbounded extrapolation of sRGB similar to [[scRGB]].<ref>{{cite web |url=https://www.w3.org/TR/css3-color/#rgb-color |at=section 4.2.1. RGB color values |title=CSS Color Module Level 3 |date=7 June 2011 |publisher=W3C |editor1-first=Tantek |editor1-last=Çelik |editor2-first=Chris |editor2-last=Lilley |editor3-first=L. David |editor3-last=Baron |first1=Steven |last1=Pemberton |first2=Brad |last2=Pettit }}</ref> Specifying a non-sRGB color this way requires the <code>RGB()</code> function call. It is impossible with the hexadecimal syntax (and thus impossible in legacy [[HTML]] documents that do not use CSS).
The first versions of [[Mosaic (web browser)|Mosaic]] and [[Netscape Navigator]] used the [[X11 color names]] as the basis for their color lists, as both started as [[X Window System]] applications. The origin of the X11 color list is unknown. [http://lists.w3.org/Archives/Public/www-style/2002May/0138.html]
 
The first versions of [[Mosaic (web browser)|Mosaic]] and [[Netscape Navigator]] used the [[X11 color names]] as the basis for their color lists, as both started as [[X Window System]] applications.
Web colors have an unambiguous colorimetric definition, [[sRGB]], which relates the [[chromaticity|chromaticities]] of a particular [[phosphor]] set, a given transfer curve, adaptive whitepoint, and viewing conditions. These have been chosen to be similar to many real-world monitors and viewing conditions, so that even without [[color management]] rendering is fairly close to the specified values. However, [[user agent]]s vary in the fidelity with which they represent the specified colors. More advanced user agents use color management to provide better color fidelity; this is particularly important for Web to print applications.
Web colors have an unambiguous colorimetric definition, [[sRGB]], which relates the [[chromaticity|chromaticities]] of a particular [[phosphor]] set, a given transfer curve, adaptive whitepoint, and viewing conditions.<ref>{{cite book |last1=Sharma |first1=Gaurav |last2=Bala |first2=Raja |title=Digital Color Imaging Handbook |date=19 December 2017 |publisher=CRC Press |isbn=978-1-4200-4148-4 |url=https://books.google.com/books?id=OxlBqY67rl0C&q=srgb&pg=PA89 |language=en}}</ref> These have been chosen to be similar to many real-world [[Computer monitor|monitors]] and viewing conditions, to allow rendering to be fairly close to the specified values even without [[color management]]. [[User agent]]s vary in the fidelity with which they represent the specified colors. More advanced user agents use color management to provide better color fidelity; this is particularly important for [[Web-to-print]] applications.
 
== Hex triplet ==
A '''hex triplet''' is a six-digit (or eight-digit), three-[[byte]] (or four-byte) [[hexadecimal]] number used in [[HTML]], [[CSS]], [[SVG]], and other computing applications to represent colors. The bytes represent the red, green, and blue components of the color. The optional fourth byte refers to [[alpha channel]]. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the lowest (0) to the highest (255) intensity of each of the color components. Thus web colors specify colors in the [[24-bit color|24-bit RGB color scheme]]. The hex triplet is formed by [[Concatenation|concatenating]] three bytes in hexadecimal notation, in the following order:
* Byte 1: red value (color type red)
* Byte 2: green value (color type green)
* Byte 3: blue value (color type blue)
* Byte 4 (optional): alpha value
For example, consider the color where the red/green/blue values are decimal numbers: red=123, green=58, blue=30 (a hardwood brown color). The decimal numbers 123, 58, and 30 are equivalent to the hexadecimal numbers 7B, 3A, and 1E, respectively. The hex triplet is obtained by concatenating the six hexadecimal digits together, 7B3A1E in this example.
 
If any one of the three color values is less than 10 hex (16 decimal), it must be represented with a leading zero so that the triplet always has exactly six digits. For example, the decimal triplet 4, 8, 16 would be represented by the hex digits 04, 08, 10, forming the hex triplet 040810.
A '''hex triplet''' is a six-digit, three-[[byte]] [[hexadecimal]] number used in [[HTML]] and [[Cascading Style Sheets|CSS]], and other computing applications, to represent [[color]]s. The bytes represent the red, green and blue components of the color. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the least (0) to the most (255) intensity of each of the color components. The hex triplet is formed by concatenating three bytes in hexadecimal notation, in the following order:
:Byte 1: red value
:Byte 2: green value
:Byte 3: blue value
For example, consider the color where the red/green/blue values are decimal numbers: red=36, green=104, blue=160 (a greyish-blue color). The decimal numbers 36, 104 and 160 are 24, 68 and A0 respectively in hexadecimal notation. To obtain the hex triplet, we simply write the three hex bytes together without spaces, thus: 2468A0. If a byte is less than 16 (decimal) or 10 (hex) it must be represented with a leading zero to keep the number of digits in the triplet equal to six. For example, the decimal triplet 0,1,2 would be represented by the hex triplet 000102.
 
The number of colors that can be represented by this system is 256<sup>3</sup>, 16<sup>6</sup>, or 2<sup>24</sup> = 16,777,216.
 
===Shorthand hexadecimal form===
:<math>256 \times 256 \times 256 = 16,777,216</math>
An abbreviated, three (hexadecimal)-digit or four-digit form can be used,<ref>{{cite web |url=http://www.w3.org/TR/css3-color/#rgb-color |publisher=W3C |work=CSS Color Module Level 3 |title=4.2.1. RGB color values |date=7 June 2011 |editor1-first=Tantek |editor1-last=Çelik |editor2-first=Chris |editor2-last=Lilley |editor3-first=L. David |editor3-last=Baron |first1=Steven |last1=Pemberton |first2=Brad |last2=Pettit |access-date=19 March 2013 }}</ref> but can cause errors if software or maintenance scripts are only expecting the long form. Expanding this form to the six-digit form is as simple as repeating each digit: 09C becomes 0099CC as presented on the following [[Cascading Style Sheets|CSS]] example:
 
<syntaxhighlight lang="css">
=== Converting RGB to hexadecimal ===
.threedigit { color: #09C; }
.sixdigit { color: #0099CC; } /* same color as above */
</syntaxhighlight>
 
This shorthand form reduces the palette to 4,096 colors, equivalent of 12-bit color as opposed to 24-bit color using the whole six-digit form (16,777,216 colors). This limitation is sufficient for many text-based documents.
Converting a decimal RGB value to a hexadecimal value is fairly straightforward. RGB values are usually given in the 0-255 range; if they are in the 0-1 range, multiply the value by 255 before conversion. The number of times this number divides into 16 gives us the first hexadecimal digit (between 0 and F, see [[hexadecimal]] if unsure). The remainder gives us the second digit. For instance the RGB value 201 divides 12 times into 16, thus the first digit is C. A remainder of 9 gives us the hexadecimal number C9. This process is repeated for each color value. Most modern [[operating system]]s have a built-in calculator to perform conversions between number bases; this can also be done with some calculators. This task can also be carried out with various Internet resources, for instance the website http://www.telacommunications.com/nutshell/rgbform.htm.
 
===Converting RGB to hexadecimal===
== HTML color names ==
{{See also|Hexadecimal#Conversion}}
RGB values are usually given in the 0–255 range; if they are in the 0–1 range, the values are multiplied by 255 before conversion. This number divided by sixteen (integer division; ignoring any remainder) gives the first hexadecimal digit (between 0 and F, where the letters A to F represent the numbers 10 to 15. See [[hexadecimal]] for more details). The remainder gives the second hexadecimal digit. For instance, the RGB value 58 (as shown in the previous example of hex triplets) divides into 3 groups of 16, thus the first digit is 3. A remainder of ten gives the hexadecimal number 3A. Likewise, the RGB value 201 divides into 12 groups of 16, thus the first digit is C. A remainder of nine gives the hexadecimal number C9. This process is repeated for each of the three color values.
 
Conversion between number bases is a common feature of calculators, including both hand-held models and the software calculators bundled with most modern [[operating system]]s. Web-based tools specifically for converting color values are also available.
The [[HTML]] 4.01 specification<ref>[http://www.w3.org/TR/REC-html40/types.html#h-6.5 HTML 4.01 Specification section 6.5 "Colors"]</ref> defines sixteen named colors, as follows (names are defined in this context to be case independent):
 
==HTML color names==
{| class="wikitable"
!Color
!Hexadecimal
!Color
!Hexadecimal
!Color
!Hexadecimal
!Color
!Hexadecimal
|-
|[[aquamarine (color)|aqua]]
|style="background:#00ffff; color:#000000; font-family:monospace;"|#00ffff
|[[black]]
|style="background:#000000; color:#ffffff; font-family:monospace;"|#000000
|[[blue]]
|style="background:#0000ff; color:#ffffff; font-family:monospace;"|#0000ff
|[[fuchsia (color)|fuchsia]]
|style="background:#ff00ff; color:#000000; font-family:monospace;"|#ff00ff
|-
|[[grey|gray]]
|style="background:#808080; color:#ffffff; font-family:monospace;"|#808080
|[[green]]
|style="background:#008000; color:#ffffff; font-family:monospace;"|#008000
|[[lime (color)|lime]]
|style="background:#00ff00; color:#000000; font-family:monospace;"|#00ff00
|[[maroon (color)|maroon]]
|style="background:#800000; color:#ffffff; font-family:monospace;"|#800000
|-
|[[Navy blue|navy]]
|style="background:#000080; color:#ffffff; font-family:monospace;"|#000080
|[[olive (color)|olive]]
|style="background:#808000; color:#ffffff; font-family:monospace;"|#808000
|[[purple]]
|style="background:#800080; color:#ffffff; font-family:monospace;"|#800080
|[[red]]
|style="background:#ff0000; color:#ffffff; font-family:monospace;"|#ff0000
|-
|[[silver (color)|silver]]
|style="background:#c0c0c0; color:#000000; font-family:monospace;"|#c0c0c0
|[[teal (color)|teal]]
|style="background:#008080; color:#ffffff; font-family:monospace;"|#008080
|[[white]]
|style="background:#ffffff; color:#000000; font-family:monospace;"|#ffffff
|[[yellow]]
|style="background:#ffff00; color:#000000; font-family:monospace;"|#ffff00
|}
 
Recent [[W3C]] specifications of color names distinguishes between ''basic'' and ''extended'' colors.<ref name='w3orgcss3color'>{{cite web|url=https://www.w3.org/TR/2011/REC-css3-color-20110607/ |title=CSS Color Module Level 3|publisher=W3c|access-date=19 July 2020}}</ref> In HTML and XHTML, colors can be used for text, background color, frame borders, tables, and individual table cells.<ref>{{Cite book|last=Powell|first=Thomas A.|title=HTML & CSS: The Complete Reference, Fifth Edition|publisher=McGraw-Hill|year=2010|isbn=9780071741705|___location=New York|page=765}}</ref>
These 16 were also specified as sRGB and included in the HTML 3.0 specification which noted "These colors were originally picked as being the standard 16 colors supported with the Windows VGA palette." <ref>[http://www.w3.org/TR/REC-html32#body HTML 3.2 Specification "The BODY element"]</ref>
[[File:Untitled Diagram.drawio.png|class=skin-invert-image|thumb|A Diagram containing every basic HTML color.]]
 
===Basic colors===
== X11 color names ==
 
The basic colors are 16 colors defined in the [[HTML]] 4.01 specification, ratified in 1999,<ref>{{cite web|url=http://www.w3.org/TR/REC-html40/types.html#h-6.5|title=HTML 4.01 Specification {{!}} Basic HTML data types {{!}} Colors |publisher=W3C|access-date=8 July 2013}}</ref> as follows (names are defined in this context to be case-insensitive):
In addition, a number of colors are defined by [[web browser]]s such as [[Internet Explorer]] or [[Mozilla Firefox]]. A particular browser may not recognize all of these colors, but as of [[2005]] all modern general-use browsers support the full list. Many of these colors are from the list of [[X11 color names]] distributed with the [[X Window System]]. These colors were standardized by [[Scalable Vector Graphics|SVG 1.0]], and are accepted by [[Scalable Vector Graphics|SVG Full]] user agents. They are not part of [[Scalable Vector Graphics|SVG Tiny]].
{{Colornames}}
 
These 16 were labeled as sRGB and included in the HTML 3.0 specification, which noted they were "the standard 16 colors supported with the Windows [[Video Graphics Array|VGA]] palette."<ref>{{cite web|url=http://www.w3.org/TR/REC-html32#body |title=HTML 3.2 Reference Specification {{!}} The BODY element |publisher=W3C |access-date=8 July 2013 |first=Dave |last=Raggett}}</ref>
The list of colors actually shipped with the X11 product varies between implementations, and clashes with certain of the HTML names such as green. Furthermore, X11 colors are defined as simple RGB (hence, no particular color), rather than sRGB. This means that the list of colors found in X11 (e.g. in /usr/lib/X11/rgb.txt) should not directly be used to choose colors for the web.<ref>[http://lists.w3.org/Archives/Public/www-svg/2002Apr/0052.html Public discussion on SVG mailing list ''Re: color names in SVG-1.0 conflict with /usr/lib/X11/rgb.txt'']</ref>
 
===Extended colors<span class="anchor" id="X11 color names"></span>===
Some of the web "X11 colors", along with their hexadecimal equivalents, are listed below. For a full list, which also displays by both name and hexadecimal in your browser, see http://www.w3.org/TR/2001/WD-css3-color-20010305#x11-color.
[[File:SVG Recognized color keyword names.svg|thumbnail|SVG Version of X11 color names]]
[[File:SVG1.1 Color Swatch.svg|thumb|SVG1.1 named colors with sRGB hex/dec and HSL codes, at UHD (4K) resolution]]
 
Extended colors are the result of merging specifications from HTML 4.01, CSS 2.0, SVG 1.0 and CSS3 User Interfaces (CSS3 UI).<ref name='w3orgcss3color' />
{| class="wikitable"
 
Several colors are defined by [[web browser]]s. A particular browser may not recognize all of these colors, but as of 2005, all modern, general-use, graphical browsers support the full list of colors. Many of these colors are from the list of [[X11 color names]] distributed with the [[X Window System]]. These colors were standardized by [[SVG|SVG 1.0]], and are accepted by [[SVG|SVG Full]] user agents. They are not part of [[SVG|SVG Tiny]].
 
The list of colors shipped with the X11 product varies between implementations and clashes with certain of the HTML names such as green. X11 colors are defined as simple [[RGB color model|RGB]] (hence, no particular color space), rather than [[sRGB]]. This means that the list of colors found in X11 (e.g., in /usr/lib/X11/rgb.txt) should not directly be used to choose colors for the web.<ref>{{cite web|url=//lists.w3.org/Archives/Public/www-svg/2002Apr/0052.html |title=Re: color names in SVG-1.0 conflict with /usr/lib/X11/rgb.txt |publisher=W3C Public mailing list archives |access-date=8 July 2013 |first=Chris |last=Lilley |date=24 Apr 2002}}</ref>
 
The list of web "X11 colors" from the CSS3 specification, along with their hexadecimal and decimal equivalents, is shown below. Compare the alphabetical lists in the W3C standards. This includes the common synonyms: aqua (HTML4/CSS 1.0 standard name) and [[cyan]] (common sRGB name), fuchsia (HTML4/CSS 1.0 standard name) and [[magenta]] (common sRGB name), gray (HTML4/CSS 1.0 standard name) and grey.<ref>{{cite web
|url=http://www.w3.org/TR/css3-color/#svg-color |publisher=W3C |work=CSS Color Module Level 3 |title=4.3. Extended color keywords |date=7 June 2011 |editor1-first=Tantek |editor1-last=Çelik |editor2-first=Chris |editor2-last=Lilley |editor3-first=L. David |editor3-last=Baron |first1=Steven |last1=Pemberton |first2=Brad |last2=Pettit |access-date=19 March 2013 }}</ref><ref>{{cite web|url=https://www.w3.org/TR/2011/REC-SVG11-20110816/types.html#ColorKeywords |title=Scalable Vector Graphics (SVG) 1.1 (Second Edition) {{!}} Basic Data Types and Interfaces {{!}} Recognized color keyword names |publisher=W3C |date=16 August 2011 |access-date=1 Feb 2019}}</ref>
 
{{clear}}
{{Color chart X11}}
 
==CSS colors==
The [[Cascading Style Sheets]] specification defines the same number of named colors as the HTML 4 spec, namely the 16 [[#HTML color names|HTML colors]], and 124 colors from the Netscape [[#X11 color names|X11 color list]] for a total of 140 names that were recognized by Internet Explorer (IE) 3.0 and Netscape Navigator 3.0.<ref>{{cite web |url=http://cng.seas.rochester.edu/CNG/docs/x11color.html |title=The X11 Color Set |access-date=6 July 2014 |url-status=dead |archive-url=https://web.archive.org/web/20140714181359/http://cng.seas.rochester.edu/CNG/docs/x11color.html |archive-date=Jul 14, 2014 |website=Computing and Networking in HSEAS }}</ref> Blooberry.com notes that Opera 2.1 and Safari 1 also included Netscape's expanded list of 140 color names, but later discovered 14 names not included with Opera 3.5 on Windows 98.<ref>{{cite web |url=http://www.blooberry.com/indexdot/color/colors.htm |title=Colors in HTML and CSS |author=Brian Wilson |access-date=6 July 2014 |website=blooberry.com }}</ref>
 
In CSS 2.1, the color 'orange' (one of the 140) was added to the section with the 16 HTML4 colors as a 17th color.<ref>{{cite web |url=http://www.w3.org/TR/CSS21/syndata.html#color-units |title=CSS 2.1 Specification: Syntax and basic data types: Colors |date=8 September 2009 |access-date=21 December 2009 |website=W3C }}</ref> The CSS3.0 specification did not include ''orange'' in the "HTML4 color keywords" section, which was renamed as "Basic color keywords".<ref>{{cite web |url=http://www.w3.org/TR/2010/PR-css3-color-20101028/#changes |title=CSS Color Module Level 3 – Proposed Recommendation - 11. Changes |date=28 October 2010 | access-date=6 July 2014 |website=W3C }}</ref> In the same reference, the "SVG color keywords" section, was renamed "Extended color keywords", after starting out as "X11 color keywords" in an earlier working draft.<ref>{{cite web |url=http://www.w3.org/TR/2002/WD-css3-color-20020418/ |title=CSS3 module: Color {{!}} Working Draft |date=18 April 2002 |access-date=6 July 2014 |website=W3C }}</ref> The working draft for the level 4 color module combines the Basic and Extended sections together in a simple "Named Colors" section.<ref name="css4">{{cite web |url=http://dev.w3.org/csswg/css-color/#named-colors |title=CSS Color Module Level 4{{snd}} Named Colors}}</ref>
 
<div style="margin-left:3%; margin-right:3%;">
{{Colort|caption=Color added in CSS 2.1}}
{{Colort/Color|name=[[Orange (colour)|Orange]]|r=255|g=165|b=0}}
|}</div>
 
CSS 2, [[Scalable Vector Graphics|SVG]] and CSS 2.1 allow web authors to use ''system colors'', which are color names whose values are taken from the [[operating system]], picking the operating system's highlighted text color, or the background color for tooltip controls. This enables web authors to style their content in line with the operating system of the user agent.<ref>{{cite web|url=http://www.w3.org/TR/CSS21/ui.html#system-colors |title=User interface – System colors |publisher=W3C |access-date=8 July 2013}}</ref> The [[CSS3]] color module has [[deprecated]] the use of system colors in favor of CSS3 UI System Appearance property,<ref>{{cite web |url=http://www.w3.org/TR/css3-color/#css2-system |publisher=W3C |work=CSS Color Module Level 3 |title=4.5.1. CSS2 system colors |date=7 June 2011 |editor1-first=Tantek |editor1-last=Çelik |editor2-first=Chris |editor2-last=Lilley |editor3-first=L. David |editor3-last=Baron |first1=Steven |last1=Pemberton |first2=Brad |last2=Pettit |access-date=19 March 2013 }}</ref><ref>{{cite web|url=http://www.w3.org/TR/2004/CR-css3-ui-20040511/#system |title=CSS3 Basic User Interface Module {{!}} System Appearance |publisher=W3C |access-date=8 July 2013}}</ref> which itself was subsequently dropped from CSS3.<ref>{{cite web |url=http://www.w3.org/TR/css3-ui/#changes-list |work=CSS Basic User Interface Module Level 3 |publisher=W3C |date=17 January 2012 |title=List of substantial changes |quote=System Appearance has been dropped, including appearance values & property, and system fonts / extension of the 'font' property shorthand. |editor-first=Tantek |editor-last=Çelik |access-date=19 March 2013 }}</ref>
 
{| class="wikitable" | style="width: 250px; max-width: 100%;"
|+ Example system color keywords
|-
! style="width: 20px" | Appearance !! Keyword
!color
!hexadecimal
!color
!hexadecimal
|-
| style="background:linkText" | || style="font-family: monospace;" | linkText
|indian-red
|style="background:#cd5c5c; color:#ffffff; font-family:monospace;"|#cd5c5c
|dark-salmon
|style="background:#e9967a; color:#ffffff; font-family:monospace;"|#e9967a
|-
| style="background:visitedText" | || style="font-family: monospace;" | visitedText
|light-coral
|style="background:#f08080; color:#ffffff; font-family:monospace;"|#f08080
|[[salmon (color)|salmon]]
|style="background:#fa8072; color:#ffffff; font-family:monospace;"|#fa8072
|-
| style="background:activeText" | || style="font-family: monospace;" | activeText
|orangered
|style="background:#ff4500; color:#ffffff; font-family:monospace;"|#ff4500
|[[red]]
|style="background:#ff0000; color:#ffffff; font-family:monospace;"|#ff0000
|-
| style="background:highlight" | || style="font-family: monospace;" | highlight
|[[crimson]]
|style="background:#dc143c; color:#ffffff; font-family:monospace;"|#dc143c
|fire-[[brick (color)|brick]]
|style="background:#b22222; color:#ffffff; font-family:monospace;"|#b22222
|-
| style="background:mark" | || style="font-family: monospace;" | mark
|dark-red
|style="background:#8b0000; color:#ffffff; font-family:monospace;"|#8b0000
|medium-violet-red
|style="background:#c71585; color:#ffffff; font-family:monospace;"|#c71585
|-
|[[pink]]
|style="background:#ffc0cb; font-family:monospace;"|#ffc0cb
|light-pink
|style="background:#ffb6c1; font-family:monospace;"|#ffb6c1
|-
|[[#pink2|hotpink]]
|style="background:#ff69b4; font-family:monospace;"|#ff69b4
|deep-pink
|style="background:#ff1493; font-family:monospace;"|#ff1493
|-
|pale-violet-red
|style="background:#db7093; font-family:monospace;"|#db7093
|dark-khaki
|style="background:#bdb76b; font-family:monospace;"|#bdb76b
|-
|[[khaki]]
|style="background:#f0e68c; font-family:monospace;"|#f0e68c
|pale-[[goldenrod (color)|goldenrod]]
|style="background:#eee8aa; font-family:monospace;"|#eee8aa
|-
|light-[[goldenrod]]-yellow
|style="background:#fafad2; font-family:monospace;"|#fafad2
|light-yellow
|style="background:#ffffe0; font-family:monospace;"|#ffffe0
|-
|lemon-chiffon
|style="background:#fffacd; font-family:monospace;"|#fffacd
|[[yellow]]
|style="background:#ffff00; font-family:monospace;"|#ffff00
|-
|[[gold]]
|style="background:#ffd700; font-family:monospace;"|#ffd700
|papaya-whip
|style="background:#ffefd5; font-family:monospace;"|#ffefd5
|-
|[[moccasin]]
|style="background:#ffe4b5; font-family:monospace;"|#ffe4b5
|[[peach (color)|peach]]-puff
|style="background:#ffdab9; font-family:monospace;"|#ffdab9
|-
|[[cyan]]
|style="background:#00ffff; font-family:monospace;"|#00ffff
|[[aqua]]
|style="background:#00ffff; font-family:monospace;"|#00ffff
|-
|[[aquamarine]]
|style="background:#7fffd4; font-family:monospace;"|#7fffd4
|[[turquoise]]
|style="background:#40e0d0; font-family:monospace;"|#40e0d0
|-
|medium-turquoise
|style="background:#48d1cc; font-family:monospace;"|#48d1cc
|dark-turquoise
|style="background:#00ced1; font-family:monospace;"|#00ced1
|-
|cadet-blue
|style="background:#5f9ea0; color:#ffffff; font-family:monospace;"|#5f9ea0
|slate-gray
|style="background:#708090; color:#ffffff; font-family:monospace;"|#708090
|-
|light-cyan
|style="background:#e0ffff; font-family:monospace;"|#e0ffff
|pale-turquoise
|style="background:#afeeee; font-family:monospace;"|#afeeee
|-
|powder-blue
|style="background:#b0e0e6; font-family:monospace;"|#b0e0e6
|light-steel-blue
|style="background:#b0c4de; font-family:monospace;"|#b0c4de
|-
|steel-blue
|style="background:#4682b4; color:#ffffff; font-family:monospace;"|#4682b4
|light-blue
|style="background:#add8e6; font-family:monospace;"|#add8e6
|-
|[[sky blue]]
|style="background:#87ceeb; font-family:monospace;"|#87ceeb
|light-sky-blue
|style="background:#87cefa; font-family:monospace;"|#87cefa
|-
|deep-skyblue
|style="background:#00bfff; font-family:monospace;"|#00bfff
|[[cornflower]]-blue
|style="background:#6495ed; font-family:monospace;"|#6495ed
|-
|royal-blue
|style="background:#4169e1; font-family:monospace;"|#4169e1
|medium-slate-blue
|style="background:#7b68ee; font-family:monospace;"|#7b68ee
|-
|dodger-blue
|style="background:#1e90ff; font-family:monospace;"|#1e90ff
|[[blue]]
|style="background:#0000ff; color:#ffffff; font-family:monospace;"|#0000ff
|-
|medium-blue
|style="background:#0000cd; color:#ffffff; font-family:monospace;"|#0000cd
|dark-blue
|style="background:#00008b; color:#ffffff; font-family:monospace;"|#00008b
|-
|[[navy]]
|style="background:#000080; color:#ffffff; font-family:monospace;"|#000080
|midnight-blue
|style="background:#191970; color:#ffffff; font-family:monospace;"|#191970
|-
|light-[[salmon (color)|salmon]]
|style="background:#ffa07a; font-family:monospace;"|#ffa07a
|[[orange]]
|style="background:#ffa500; font-family:monospace;"|#ffa500
|-
|dark-orange
|style="background:#ff8c00; font-family:monospace;"|#ff8c00
|[[coral (color)|coral]]
|style="background:#ff7f50; font-family:monospace;"|#ff7f50
|-
|[[tomato (color)|tomato]]
|style="background:#ff6347; font-family:monospace;"|#ff6347
|orange-red
|style="background:#ff4500; font-family:monospace;"|#ff4500
|-
|[[aquamarine]]
|style="background:#7fffd4; font-family:monospace;"|#7fffd4
|medium-spring-green
|style="background:#00fa9a; font-family:monospace;"|#00fa9a
|-
|spring-green
|style="background:#00ff7f; font-family:monospace;"|#00ff7f
|pale-green
|style="background:#98fb98; font-family:monospace;"|#98fb98
|-
|green-yellow
|style="background:#adff2f; font-family:monospace;"|#adff2f
|chartreuse
|style="background:#7fff00; font-family:monospace;"|#7fff00
|-
|lawn-green
|style="background:#7cfc00; font-family:monospace;"|#7cfc00
|[[lime (color)|lime]]
|style="background:#00ff00; font-family:monospace;"|#00ff00
|-
|light-green
|style="background:#90ee90; font-family:monospace;"|#90ee90
|yellow-green
|style="background:#9acd32; font-family:monospace;"|#9acd32
|-
|lime-green
|style="background:#32cd32; font-family:monospace;"|#32cd32
|medium-seagreen
|style="background:#3cb371; font-family:monospace;"|#3cb371
|-
|dark-seagreen
|style="background:#8fbc8f; font-family:monospace;"|#8fbc8f
|forest-green
|style="background:#228b22; color:#ffffff; font-family:monospace;"|#228b22
|-
|seagreen
|style="background:#2e8b57; color:#ffffff; font-family:monospace;"|#2e8b57
|[[green]]
|style="background:#008000; color:#ffffff; font-family:monospace;"|#008000
|-
|olive-drab
|style="background:#6b8e23; color:#ffffff; font-family:monospace;"|#6b8e23
|[[olive (color)|olive]]
|style="background:#808000; color:#ffffff; font-family:monospace;"|#808000
|-
|dark-olive-green
|style="background:#556b2f; color:#ffffff; font-family:monospace;"|#556b2f
|dark-green
|style="background:#006400; color:#ffffff; font-family:monospace;"|#006400
|-
|medium-aquamarine
|style="background:#66cdaa; font-family:monospace;"|#66cdaa
|[[turquoise]]
|style="background:#40e0d0; font-family:monospace;"|#40e0d0
|-
|light-seagreen
|style="background:#20b2aa; font-family:monospace;"|#20b2aa
|dark-cyan
|style="background:#008b8b; color:#ffffff; font-family:monospace;"|#008b8b
|-
|[[teal]]
|style="background:#008080; color:#ffffff; font-family:monospace;"|#008080
|[[lavender (color)|lavender]]
|style="background:#e6e6fa; font-family:monospace;"|#e6e6fa
|-
|[[thistle (color)|thistle]]
|style="background:#d8bfd8; font-family:monospace;"|#d8bfd8
|[[plum (color)|plum]]
|style="background:#dda0dd; font-family:monospace;"|#dda0dd
|-
|[[violet (color)|violet]]
|style="background:#ee82ee; font-family:monospace;"|#ee82ee
|[[fuchsia]]
|style="background:#ff00ff; font-family:monospace;"|#ff00ff
|-
|[[magenta]]
|style="background:#ff00ff; font-family:monospace;"|#ff00ff
|[[orchid]]
|style="background:#da70d6; font-family:monospace;"|#da70d6
|-
|medium-orchid
|style="background:#ba55d3; font-family:monospace;"|#ba55d3
|dark-orchid
|style="background:#9932cc; color:#ffffff; font-family:monospace;"|#9932cc
|-
|blue-violet
|style="background:#8a2be2; color:#ffffff; font-family:monospace;"|#8a2be2
|dark-violet
|style="background:#9400d3; color:#ffffff; font-family:monospace;"|#9400d3
|-
|medium-purple
|style="background:#9370db; color:#ffffff; font-family:monospace;"|#9370db
|slateblue
|style="background:#6a5acd; color:#ffffff; font-family:monospace;"|#6a5acd
|-
|[[purple]]
|style="background:#800080; color:#ffffff; font-family:monospace;"|#800080
|dark-magenta
|style="background:#8b008b; color:#ffffff; font-family:monospace;"|#8b008b
|-
|dark-slate-blue
|style="background:#483d8b; color:#ffffff; font-family:monospace;"|#483d8b
|indigo
|style="background:#4b0082; color:#ffffff; font-family:monospace;"|#4b0082
|-
|[[honeydew]]
|style="background:#f0fff0; font-family:monospace;"|#f0fff0
|mintcream
|style="background:#f5fffa; font-family:monospace;"|#f5fffa
|-
|[[azure]]
|style="background:#f0ffff; font-family:monospace;"|#f0ffff
|alice-blue
|style="background:#f0f8ff; font-family:monospace;"|#f0f8ff
|-
|ghost-white
|style="background:#f8f8ff; font-family:monospace;"|#f8f8ff
|white-smoke
|style="background:#f5f5f5; font-family:monospace;"|#f5f5f5
|-
|lavender-blush
|style="background:#fff0f5; font-family:monospace;"|#fff0f5
|misty-rose
|style="background:#ffe4e1; font-family:monospace;"|#ffe4e1
|-
|antique-white
|style="background:#faebd7; font-family:monospace;"|#faebd7
|sea-shell
|style="background:#fff5ee; font-family:monospace;"|#fff5ee
|-
|[[snow]]
|style="background:#fffafa; font-family:monospace;"|#fffafa
|[[white]]
|style="background:#ffffff; font-family:monospace;"|#ffffff
|-
|[[beige]]
|style="background:#f5f5dc; font-family:monospace;"|#f5f5dc
|[[linen (color)|linen]]
|style="background:#faf0e6; font-family:monospace;"|#faf0e6
|-
|old-lace
|style="background:#fdf5e6; font-family:monospace;"|#fdf5e6
|floral-white
|style="background:#fffaf0; font-family:monospace;"|#fffaf0
|-
|ivory
|style="background:#fffff0; font-family:monospace;"|#fffff0
|gainsboro
|style="background:#dcdcdc; font-family:monospace;"|#dcdcdc
|-
|light-grey
|style="background:#d3d3d3; font-family:monospace;"|#d3d3d3
|[[silver (color)|silver]]
|style="background:#c0c0c0; font-family:monospace;"|#c0c0c0
|-
|dark-gray
|style="background:#a9a9a9; font-family:monospace;"|#a9a9a9
|gray
|style="background:#808080; color:#ffffff; font-family:monospace;"|#808080
|-
|dim-gray
|style="background:#696969; color:#ffffff; font-family:monospace;"|#696969
|dark-slate-gray
|style="background:#2f4f4f; color:#ffffff; font-family:monospace;"|#2f4f4f
|-
|light-slate-gray
|style="background:#778899; color:#ffffff; font-family:monospace;"|#778899
|slate-gray
|style="background:#708090; color:#ffffff; font-family:monospace;"|#708090
|-
|cornsilk
|style="background:#fff8dc; font-family:monospace;"|#fff8dc
|blanchedalmond
|style="background:#ffebcd; font-family:monospace;"|#ffebcd
|-
|[[bisque]]
|style="background:#ffe4c4; font-family:monospace;"|#ffe4c4
|navajowhite
|style="background:#ffdead; font-family:monospace;"|#ffdead
|-
|[[wheat (color)|wheat]]
|style="background:#f5deb3; font-family:monospace;"|#f5deb3
|sandy-brown
|style="background:#f4a460; font-family:monospace;"|#f4a460
|-
|[[goldenrod]]
|style="background:#daa520; font-family:monospace;"|#daa520
|dark-goldenrod
|style="background:#b8860b; font-family:monospace;"|#b8860b
|-
|[[peru]]
|style="background:#cd853f; font-family:monospace;"|#cd853f
|[[chocolate (color)|chocolate]]
|style="background:#d2691e; font-family:monospace;"|#d2691e
|-
|maroon
|style="background:#800000; color:#ffffff; font-family:monospace;"|#800000
|saddlebrown
|style="background:#8b4513; color:#ffffff; font-family:monospace;"|#8b4513
|-
|brown
|style="background:#a52a2a; color:#ffffff; font-family:monospace;"|#a52a2a
|sienna
|style="background:#a0522d; color:#ffffff; font-family:monospace;"|#a0522d
|-
|darkred
|style="background:#8b0000; color:#ffffff; font-family:monospace;"|#8b0000
|burlywood
|style="background:#deb887; font-family:monospace;"|#deb887
|-
|tan
|style="background:#d2b48c; font-family:monospace;"|#d2b48c
|rosybrown
|style="background:#bc8f8f; font-family:monospace;"|#bc8f8f
|-
|black
|style="background:#000000; color:#ffffff; font-family:monospace;"|#000000
|peanut butter/caramel
|style="background:#8c6638; color:#ffffff; font-family:monospace;"|#8c6638
|}
 
The CSS3 specification also introduces [[HSL color space]] values to style sheets:<ref name=C3>{{cite web |url=http://www.w3.org/TR/css3-color/#hsl-color |publisher=W3C |work=CSS Color Module Level 3 |title=4.2.4. HSL color values |date=7 June 2011 |editor1-first=Tantek |editor1-last=Çelik |editor2-first=Chris |editor2-last=Lilley |editor3-first=L. David |editor3-last=Baron |first1=Steven |last1=Pemberton |first2=Brad |last2=Pettit |access-date=19 March 2013 }}</ref>
<syntaxhighlight lang="CSS">
/* RGB model */
p { color: #F00 } /* #rgb */
p { color: #FF0000 } /* #rrggbb */
p { color: rgb(255, 0, 0) } /* integer range 0 - 255 */
p { color: rgb(100%, 0%, 0%) } /* float range 0.0% - 100.0% */
 
/* RGB with alpha channel, added to CSS3 */
p { color: rgba(255, 0, 0, 0.5) } /* 50% opacity, semi-transparent */
 
/* HSL model, added to CSS3 */
p { color: hsl(0, 100%, 50%) } /* red */
p { color: hsl(120, 100%, 50%) } /* green */
p { color: hsl(120, 100%, 25%) } /* dark green */
p { color: hsl(120, 100%, 75%) } /* light green */
p { color: hsl(120, 50%, 50%) } /* pastel green */
 
/* HSL model with alpha channel */
p { color: hsla(120, 100%, 50%, 1) } /* green */
p { color: hsla(120, 100%, 50%, 0.5) } /* semi-transparent green */
p { color: hsla(120, 100%, 50%, 0.1) } /* very transparent green */
</syntaxhighlight>
 
CSS also supports the special color <code>transparent</code>, which represents an alpha value of zero; by default, <code>transparent</code> is rendered as an invisible nominal black: <code>rgba(0, 0, 0, 0)</code>. It was introduced in CSS1 but its scope of use has expanded over the versions.<ref name=C3/>
 
=== CSS Color 4 ===
Level 4 of the CSS Color specification introduced several new CSS color formats.<ref name=CSSC4>{{cite web|url=https://www.w3.org/TR/css-color-4/ |title=CSS Color Module Level 4 |publisher=W3C |date= |accessdate=2022-03-14}}</ref>
 
Besides new ways to write colors, it also introduces the concept of mixing colors in a non-[[sRGB]] color space, a first step towards fixing [[Color gradient#Effect of color space|a well-known issue in color gradients]]. Some sections explaining color theory and common operations like [[gamut mapping]] are also added to aid implementation.<ref name=CSSC4/>
<syntaxhighlight lang="CSS">
p { color: #F80A } /* #rgba */
p { color: #FF8800AA } /* #rrggbbaa */
p { color: rgb(255.0 136.0 0.0 / 0.667) } /* float range 0.0 - 255.0 for higher than 8-bit precision */
p { color: rgb(100% 53.3% 0% / 66.7%) } /* float range 0.0% - 100.0% */
p { color: color(sRGB 1 0.533 0 / 0.667) } /* color() function with color space */
</syntaxhighlight>
 
==== Device independent color ====
CSS Color 4 introduces several different formats for [[Color management|device independent color]] that can display the entirety of visible color (in a capable screen), including:<ref name="autogenerated1">{{cite web|title=CSS Color Module Level 4: Overview|url=https://www.w3.org/TR/css-color-4/Overview.html|access-date=2022-01-11|website=W3C }}</ref>
* [[CIELAB color space|CIE Lab and LCH]]
* [[OKLab|OKLab and OKLCH]] (preferred over Lab/LCH)<ref name=CSSC4/>{{rp|at=§§9.2–3}}
* [[CIE 1931 color space|XYZ]] (D50 or D65 [default])
 
==== Predefined color spaces ====
A number of [[RGB color model|RGB]] spaces with [[gamut]]s that are wider than [[sRGB]] are also introduced through the new <code>color()</code> function:<ref name="autogenerated1"/>
* [[DCI-P3|Display P3]]
* [[ProPhoto RGB color space|Prophoto]]
* [[Rec. 2020|REC.2020]]
* [[Adobe RGB color space|Adobe 1998 RGB]]
 
A linearized variant of sRGB is also defined for color mixing.<ref name=CSSC4/>
 
==== Other formats ====
{{anchor|rebeccapurple}}On 21 June 2014, the [[CSS WG]] added the color RebeccaPurple to the Editor's Draft of the Colors module level 4, to commemorate [[Eric A. Meyer|Eric Meyer]]'s daughter Rebecca, who died on 7 June 2014, her sixth birthday.<ref>{{cite web |url=//lists.w3.org/Archives/Public/www-style/2014Jun/0312.html |publisher=W3C |work=Post to www-style mailing list|title=Re: [CfC] adding 'rebeccapurple' to CSS Color Level 4|date=21 June 2014|author1-first=Daniel|author1-last=Glazman|access-date=24 June 2014 }}</ref>
 
<div style="margin-left:3%; margin-right:3%;">
{{Colort|caption=Color added in CSS4 Colors module}}
{{Colort/Color|name=RebeccaPurple|r=102|g=51|b=153}}
|}</div>
 
CSS4 also introduces the [[HWB color model]] as an alternative to HSL/HSV.<ref name="css4"/>
 
=== CSS Color 5 ===
 
The draft CSS Color 5<ref name=CSSC5>[https://www.w3.org/TR/css-color-5/ CSS Color Module Level 5]</ref> specification introduces syntax for mixing and manipulating existing colors, including:
* A <code>color-mix()</code> function for mixing colors
* Relative color syntax for manipulating components of an existing color
 
Custom color spaces are also supported via [[ICC profile]]s. This allows the use of [[CMYK]] on web pages.<ref name=CSSC5/>
 
==Web-safe colors==
{{Color depth}}
 
In the mid-1990s, many displays were only capable of displaying 256 colors,<ref>{{Cite book|url=https://books.google.com/books?id=50QM5XrxFzQC&q=In+the+early+days+of+computing%2C+many+displays+were+only+capable+of+displaying+256+colors&pg=PT195|title=Web Design All-in-One For Dummies|last=Jenkins|first=Sue|date=2012-12-27|publisher=John Wiley & Sons|isbn=9781118404119|language=en}}</ref> dictated by the hardware or changeable by a "color table". When a color was found (e.g., in an image) that was not available, a different one had to be used. This was done by either using the closest color or by using [[dither]]ing.
== Web-safe colors ==
 
AnotherThere setwere ofvarious 216 color values are commonly consideredattempts to bemake thea "web-safestandard" color palette; developed at a time when many computer displays were only capable of displaying 256 colors. A set of colors was needed that could be shown without [[dithering]] on 256-color displays; the number 216 was chosen partly because computer operating systems customarily reserved sixteen to twenty colors for their own use; it was also selected because it allowsallowed exactly six shadesequally eachspaced shades of red, green, and blue. (6 &times;× 6 &times;× 6 = 216)., Theeach palettefrom was00 firstto identifiedFF by(including [[Lyndaboth Weinman]]limits).
 
The list of colors is oftenwas presented as if it hashad special properties that render themit immune to dithering., In fact,but on 256-color displays applications cancould actually set a palette of any selection of colors that they choosechose, dithering the rest. These colors were chosen specifically because they matched the palettes selected by the then leadingvarious browser applications. Fortunately, thereThere were not radicallyvery different palettes in use in different popular browsers.{{Citation needed|date=May 2011|reason=Another editor left a comment stating, "not really, it was pretty much a disaster" - Why? Please clarify}}
 
"Web-safe" colors had a flaw in that, on systems such as [[X Window System|X WindowsX11]] where the palette is shared between applications, smaller color cubes (5x5x55×5×5 or 4x4x44×4×4) were often allocated by browsers — thus, thebrowsers—the "web -safe" colors would actually dither on such systems. BetterDifferent results were obtained by providing an image with a larger range of colors and allowing the browser to [[Color quantization|quantize]] the color space if needed, rather than suffer the quality loss of a double quantization.
 
Through the 2000s, use of 256-color displays in personal computers dropped sharply in favour of 24-bit ([[24-bit color|TrueColor]]) displays,<ref>{{cite web|url=https://www.w3schools.com/browsers/browsers_display.asp |title=Browser Display Statistics |publisher=W3Schools |access-date=8 July 2013}}</ref> and the use of "web-safe" colors has fallen into practical disuse.
By the early years of the 21st century, driven by the needs of video games and digital photos, personal computers typically had at least 16-bit color and usually 24-bit (truecolor). Even mobile devices had at least 16-bit color, driven by the inclusion of cameras on cellphones. The use of "web-safe" colors fell into disuse, but persisted as folklore.
 
The "web-safe" colors do not all have standard names, but each can be specified by an [[RGB]] triplet.: Ineach thecomponent table(red, belowgreen, aand three-digitblue) numbertakes isone used as a shorthand notation forof the six-digit hexadecimalvalues numeralsfrom above.the following Thetable digit(out "3" is equivalent toof the hexadecimal256 numeralpossible "33";values "C"available isfor equivalenteach to "CC". For example, "F63"component in thefull table below is equivalent to "#FF6633" in the system used24-bit previouslycolor).
Below are the values for the 6 shades of each color out of 256 possible color shades.
 
{| class="wikitable" style="backgroundtext-coloralign:#FFF center;color:black"|
|+ 6 shades of each color
! scope="col" | Key
! digit
! scope="col" | Hex
! hexadecimal
! scope="col" | Decimal
! decimal
! scope="col" | Fraction
|-
| 0
| 00
| 0
| style="text-align: left;" | 0
|-
| 3
| 33
| 51
| style="text-align: left;" | 0.2
|-
| 6
| 66
| 102
| style="text-align: left;" | 0.4
|-
| 9
| 99
| 153
| style="text-align: left;" | 0.6
|-
| C or (12)
| CC
| 204
| style="text-align: left;" | 0.8
|-
| F or (15)
| FF
| 255
| style="text-align: left;" | 1
|}
 
The following table shows all of the "web-safe" colors. One shortcoming of the web-safe palette is its small range of light colors for webpage backgrounds, whereas the intensities at the low end of the range, such as the two darkest, are similar to each other, making them hard to distinguish. Values flanked by "*" (asterisk) are part of the "really safe palette;" see [[#Safest web colors|Safest web colors]], below.
The following table shows all of the "web-safe" colors, underlining the ''really-safe'' (see next section) colors.
The lack of [[gamma correction]] means that the six desired intensities 0%, 20%, 40%, 60%, 80%, and 100% are displayed as 0%, 2%, 10%, 28%, 57%, and 100% on a standard 2.5 gamma CRT or LCD, making most colors very dark. The intensities at the low end of the range are nearly indistinguishable from each other:
 
===Color table===
<div align="center">
{{Web safe colors}}
{| width="80%" class="wikitable" style="color:white;width:80%;text-align:center"
 
|+ style="color:black"|''' Web-Safe Colors'''
===Safest web colors===
| style="background: #000;" | <u>000</u>
Designers were encouraged{{By whom|date=February 2024}} to stick to these 216 "web-safe" colors in their websites because there were a lot of 8-bit color displays when the 216-color palette was developed. David Lehn and Hadley Stern discovered that only 22 of the 216 colors in the web-safe palette are reliably displayed without inconsistent remapping on [[highcolor|16-bit computer displays]]. They called these 22 colors "the really safe palette"; it consists largely of shades of green, yellow, and cyan.<ref>{{cite web |url=https://www.asc.ohio-state.edu/wilkins.5/color/websafecolors.html |title=Death of the Websafe Color Palette? |publisher=asc.ohio-state.edu |access-date=3 March 2021 |archive-date=3 March 2021 |archive-url=https://web.archive.org/web/20210303202304/https://www.asc.ohio-state.edu/wilkins.5/color/websafecolors.html |url-status=dead |first1=David |last1=Lehn |first2=Hadley |last2=Stern}}</ref><ref>{{cite web|title = Web Color Reference - HTML with Style {{!}} 4 |url = http://www.webreference.com/html/reference/color/websafe.html|website = WebReference |first=Stephanos |last=Piperoglou |date=December 13, 2000 |access-date = 2016-01-05|archive-date = 23 November 2016|archive-url = https://web.archive.org/web/20161123191645/http://www.webreference.com/html/reference/color/websafe.html|url-status = dead}}</ref>
| style="background: #300;" | 300
 
| style="background: #600;" | 600
{| class="wikitable mw-no-invert" style="width:80%; text-align:center; margin: 0 auto;"
| style="background: #900;" | 900
|+ Safest web colors
| style="background: #C00;" | C00
|- style="backgroundcolor: #F00light-dark(black,white);" | <u>F00</u>
! {{diagonal split header|{{nowrap|-GB}}|{{nowrap|R--}}}}
| style="background: #003;" | <u>003</u>
!0
| style="background: #303;" | 303
!3
| style="background: #603;" | 603
!6
| style="background: #903;" | 903
!9
| style="background: #C03;" | C03
!C
| style="background: #F03;" | <u>F03</u>
!F
|-
| style="background: #006;" | 006
| style="background: #306;" | 306
| style="background: #606;" | 606
| style="background: #906;" | 906
| style="background: #C06;" | C06
| style="background: #F06;" | F06
| style="background: #009;" | 009
| style="background: #309;" | 309
| style="background: #609;" | 609
| style="background: #909;" | 909
| style="background: #C09;" | C09
| style="background: #F09;" | F09
|-
| style="background: #00C;" | 00C
| style="background: #30C;" | 30C
| style="background: #60C;" | 60C
| style="background: #90C;" | 90C
| style="background: #C0C;" | C0C
| style="background: #F0C;" | F0C
| style="background: #00F;" | <u>00F</u>
| style="background: #30F;" | 30F
| style="background: #60F;" | 60F
| style="background: #90F;" | 90F
| style="background: #C0F;" | C0F
| style="background: #F0F;" | <u>F0F</u>
|-
| style="background: #030;" | 030
| style="background: #330;" | 330
| style="background: #630;" | 630
| style="background: #930;" | 930
| style="background: #C30;" | C30
| style="background: #F30;" | F30
| style="background: #033;" | 033
| style="background: #333;" | 333
| style="background: #633;" | 633
| style="background: #933;" | 933
| style="background: #C33;" | C33
| style="background: #F33;" | F33
|-
| style="background: #036;" | 036
| style="background: #336;" | 336
| style="background: #636;" | 636
| style="background: #936;" | 936
| style="background: #C36;" | C36
| style="background: #F36;" | F36
| style="background: #039;" | 039
| style="background: #339;" | 339
| style="background: #639;" | 639
| style="background: #939;" | 939
| style="background: #C39;" | C39
| style="background: #F39;" | F39
|-
| style="background: #03C;" | 03C
| style="background: #33C;" | 33C
| style="background: #63C;" | 63C
| style="background: #93C;" | 93C
| style="background: #C3C;" | C3C
| style="background: #F3C;" | F3C
| style="background: #03F;" | 03F
| style="background: #33F;" | 33F
| style="background: #63F;" | 63F
| style="background: #93F;" | 93F
| style="background: #C3F;" | C3F
| style="background: #F3F;" | F3F
|-
!|00
| style="background: #060;" | 060
| style="width:16%; background: #360000; color: white" | 360*000*
|
| style="background: #660;" | 660
|
| style="background: #960;" | 960
| style="backgroundwidth: #C6016%;" | C60
|
| style="background: #F60;" | F60
| style="width:16%; background: #063F00; color: white" | 063*F00*
| style="background: #363;" | 363
| style="background: #663;" | 663
| style="background: #963;" | 963
| style="background: #C63;" | C63
| style="background: #F63;" | F63
|-
!|03
| style="background: #066;" | 066
| style="width:16%; background: #366003; color: white" | 366*003*
|
| style="background: #666;" | 666
|
| style="background: #966;" | 966
|
| style="background: #C66;" | C66
|
| style="background: #F66;" | F66
| style="width:16%; background: #069F03; color: white" | 069*F03*
| style="background: #369;" | 369
| style="background: #669;" | 669
| style="background: #969;" | 969
| style="background: #C69;" | C69
| style="background: #F69;" | F69
|-
!|06
| style="background: #06C;" | 06C
|
| style="background: #36C;" | 36C
|
| style="background: #66C;" | 66C
|
| style="background: #96C;" | 96C
|
| style="background: #C6C;" | C6C
|
| style="background: #F6C;" | F6C
|
| style="background: #06F;" | 06F
| style="background: #36F;" | 36F
| style="background: #66F;" | 66F
| style="background: #96F;" | 96F
| style="background: #C6F;" | C6F
| style="background: #F6F;" | F6F
|-
!|09
| style="background: #090;" | 090
|
| style="background: #390;" | 390
|
| style="background: #690;" | 690
|
| style="background: #990;" | 990
|
| style="background: #C90;" | C90
|
| style="background: #F90;" | F90
|
| style="background: #093;" | 093
| style="background: #393;" | 393
| style="background: #693;" | 693
| style="background: #993;" | 993
| style="background: #C93;" | C93
| style="background: #F93;" | F93
|-
!|0C
| style="background: #096;" | 096
|
| style="background: #396;" | 396
|
| style="background: #696;" | 696
|
| style="background: #996;" | 996
|
| style="background: #C96;" | C96
|
| style="background: #F96;" | F96
|
| style="background: #099;" | 099
| style="background: #399;" | 399
| style="background: #699;" | 699
| style="background: #999;" | 999
| style="background: #C99;" | C99
| style="background: #F99;" | F99
|-
!|0F
| style="background: #09C;" | 09C
| style="background: #39C00F; color: white" | 39C*00F*
|
| style="background: #69C;" | 69C
|
| style="background: #99C;" | 99C
|
| style="background: #C9C;" | C9C
|
| style="background: #F9C;" | F9C
| style="background: #09FF0F; color: white" | 09F*F0F*
| style="background: #39F;" | 39F
| style="background: #69F;" | 69F
| style="background: #99F;" | 99F
| style="background: #C9F;" | C9F
| style="background: #F9F;" | F9F
|- style="color: black;"
! ⋮
| style="background: #0C0;" | 0C0
| colspan="6"|⋮
| style="background: #3C0;" | 3C0
| style="background: #6C0;" | 6C0
| style="background: #9C0;" | 9C0
| style="background: #CC0;" | CC0
| style="background: #FC0;" | FC0
| style="background: #0C3;" | 0C3
| style="background: #3C3;" | 3C3
| style="background: #6C3;" | 6C3
| style="background: #9C3;" | 9C3
| style="background: #CC3;" | CC3
| style="background: #FC3;" | FC3
|- style="color: black;"
!F0
| style="background: #0C6;" | 0C6
| style="background: #3C60F0; color: black" | 3C6*0F0*
|
| style="background: #6C6;" | 6C6
| style="background: #9C66F0; color: black" | 9C6*6F0*
|
| style="background: #CC6;" | CC6
|
| style="background: #FC6;" | FC6
| style="background: #0C9FF0; color: black" | 0C9*FF0*
| style="background: #3C9;" | 3C9
| style="background: #6C9;" | 6C9
| style="background: #9C9;" | 9C9
| style="background: #CC9;" | CC9
| style="background: #FC9;" | FC9
|- style="color: black;"
!F3
| style="background: #0CC;" | 0CC
|
| style="background: #3CC;" | 3CC
| style="background: #6CC3F3; color: black" | 6CC*3F3*
| style="background: #9CC6F3; color: black" | 9CC*6F3*
|
| style="background: #CCC;" | CCC
|
| style="background: #FCC;" | FCC
| style=" background: #0CFFF3; color: black" | 0CF*FF3*
| style="background: #3CF;" | 3CF
| style="background: #6CF;" | 6CF
| style="background: #9CF;" | 9CF
| style="background: #CCF;" | CCF
| style="background: #FCF;" | FCF
|- style="color: black;"
!F6
| style="background: #0F0;" | <u>0F0</u>
| style="background: #3F00F6; color: black" | 3F0*0F6*
| style="background: #6F03F6; color: black" | <u>6F0</u>*3F6*
|
| style="background: #9F0;" | 9F0
|
| style="background: #CF0;" | CF0
| style="background: #FF0CF6; color: black" | <u>FF0</u>*CF6*
| style="background: #0F3FF6; color: black" | 0F3*FF6*
|- style="backgroundcolor: #3F3;black" | <u>3F3</u>
!F9
| style="background: #6F3;" | <u>6F3</u>
|
| style="background: #9F3;" | 9F3
|
| style="background: #CF3;" | CF3
|
| style="background: #FF3;" | <u>FF3</u>
|
|
|
|- style="color: black;"
!FC
| style="background: #0F6;" | <u>0F6</u>
| style="background: #3F60FC; color: black" | <u>3F6</u>*0FC*
| style="background: #6F63FC; color: black" | 6F6*3FC*
|
| style="background: #9F6;" | 9F6
|
| style="background: #CF6;" | <u>CF6</u>
|
| style="background: #FF6;" | <u>FF6</u>
|
| style="background: #0F9;" | 0F9
| style="background: #3F9;" | 3F9
| style="background: #6F9;" | 6F9
| style="background: #9F9;" | 9F9
| style="background: #CF9;" | CF9
| style="background: #FF9;" | FF9
|- style="color: black;"
!FF
| style="background: #0FC;" | <u>0FC</u>
| style="background: #3FC0FF; color: black" | <u>3FC</u>*0FF*
| style="background: #6FC3FF; color: black" | 6FC*3FF*
| style="background: #9FC6FF; color: black" | 9FC*6FF*
|
| style="background: #CFC;" | CFC
|
| style="background: #FFC;" | FFC
| style="background: #0FFFFF;" | <u>0FF</u>*FFF*
|}
| style="background: #3FF;" | <u>3FF</u>
| style="background: #6FF;" | <u>6FF</u>
| style="background: #9FF;" | 9FF
| style="background: #CFF;" | CFF
| style="background: #FFF;" | <u>FFF</u>
|}</div>
 
==Accessibility==
=== Really web safe colors ===
Designers were often encouraged to stick to these 216 "web-safe" colors in their websites; however, 8-bit color displays were much more common when the 216-color palette was developed than they are now. David Lehn and Hadley Stern have since discovered that only 22 of the 216 colors in the web-safe palette are reliably displayed without inconsistent remapping on [[highcolour|16-bit computer displays]]. They called these 22 colors the "really safe" palette; it consists mainly of shades of green and yellow, as can be seen in the table above, where the "really safe" colors are underlined.
 
===Color CSS colors selection===
Some [[Web browser|browsers]] and devices do not support colors. For these displays or blind and colorblind users, Web content depending on colors can be difficult or impossible to use.
 
Either no colors should be specified (to invoke the browser's default colors), or both the background and all foreground colors (such as the colors of plain text, unvisited links, hovered links, active links, and visited links) should be specified to avoid '''black on black''' or '''white on white''' effects.<ref name="w3ctips">{{cite web|url=http://www.w3.org/QA/Tips/color |title=If You Pick One Color, Pick Them All |publisher=W3C |access-date=8 July 2013}}</ref>
The [[Cascading Style Sheets]] language defines the same number of named colors as the HTML 4 spec, namely the 16 listed above.
Additionally, CSS 2.1 adds the 'orange' color name to the list:
 
===Color contrast===
{| class="wikitable"
The [[Web Content Accessibility Guidelines]] recommend a contrast ratio of at least 4.5:1 between the [[relative luminance]] of text and its background color<ref>[https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast WCAG 2.0 guideline 1.4]</ref> or at least 3:1 for large text. Enhanced accessibility requires contrast ratios greater than 7:1.
!Color
!Hexadecimal
|-
|[[orange (color)|orange]]
|style="background:#ffa500; color:#000000; font-family:monospace;"|#ffa500
|}
 
However, addressing accessibility concerns is not simply a matter of increasing the contrast ratio. As a report to the [[Web Accessibility Initiative]] indicates,<ref>[https://www.w3.org/WAI/RD/2012/text-customization/r11 Optimal Colors to Improve Readability for People with Dyslexia]</ref> [[dyslexic]] readers are better served by contrast ratios below the maximum. The recommendations they refer to of off-black (#0A0A0A) on off-white (#FFFFE5) and black (#000000) on creme (#FAFAC8) have contrast ratios of 11.7:1 and 20.3:1 respectively. Among their other color pairs, brown (#282800) on dark green (#A0A000) has a contrast ratio of 3.24:1, which is less than the [[Web Content Accessibility Guidelines|WCAG]] recommendation, dark brown (#1E1E00) on light green (#B9B900) has a contrast ratio of 4.54:1 and blue (#00007D) on yellow (#FFFF00) has a contrast ratio of 11.4:1. The colors named in the report use different color values than the web colors of the same name.
CSS 2, [[SVG]] and CSS 2.1 also allow web authors to use so-called ''system colors'', which are color names whose values are taken from the [[operating system]]. This enables web authors to style their content in line with the operating system of the user agent. See [http://www.w3.org/TR/CSS21/ui.html#system-colors]. [[As of 2004|As of early 2004]], it appears that the CSS3 color module will once again drop these values, marking them [[deprecated]], but this may change: [http://www.w3.org/TR/css3-color/#css2-system].
 
==See also==
The developing CSS3 specification will also introduce [[HSL color space]] values to style sheets:
 
{{cmn|colwidth=30em|
/* RGB model */
* [[Adobe RGB color space]]
p { color: #f00 } /* #rgb */
* [[CIE 1931 color space|CIE 1931 XYZ color space]]
p { color: #ff0000 } /* #rrggbb */
* [[International Commission on Illumination|CIE]] [[Lab color space|L*a*b* color space]]
p { color: rgb(255,0,0) } /* integer range 0 - 255 */
* [[Color picker]]
p { color: rgb(100%, 0%, 0%) } /* float range 0.0% - 100.0% */
* [[List of color palettes]]
* [[Lists of colors]]
* [[List of colors by shade]]
* [[ProPhoto RGB color space|ProPhoto RGB]]
* [[RGB color spaces]]
* [[scRGB]]
* [[Wide-gamut RGB color space]]
}}
 
==References==
/* RGB with alpha channel, added to CSS3 */
{{reflist}}
p { color: rgba(255,0,0,0.5) /* 0.5 opacity, semi-transparent */
 
==External links==
/* HSL model, added to CSS3 */
* [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value CSS color value] on [[MDN Web Docs]]
p { color: hsl(0, 100%, 50%) } /* red */
* [https://www.w3.org/TR/CSS21/syndata.html#color-units CSS2.1 Color Specification]
p { color: hsl(120, 100%, 50%) } /* green */
p { color: hsl(120, 100%, 25%) } /* light green */
p { color: hsl(120, 100%, 75%) } /* dark green */
p { color: hsl(120, 50%, 50%) } /* pastel green */
 
{{Prone to spam|date=September 2013}}
/* HSL model with alpha channel */
<!-- {{No more links}}
p { color: hsla(120, 100%, 50%, 1) } /* green */
p { color: hsla(120, 100%, 50%, 0.5) } /* semi-transparent green */
p { color: hsla(120, 100%, 50%, 0.1) } /* very transparent green */
 
Please be cautious about adding more external links.
== Accessibility ==
 
Wikipedia is not a collection of links and should not be used for advertising.
* Some [[browser]]s and devices don't support colors.
* For blind and colorblind users Web content depending on colors can be unusable or difficult to use.
* Mixing legacy markup like <tt>bgcolor</tt> with modern [[Cascading Style Sheets|CSS]] fails for legacy browsers not supporting CSS.
* The shorthand #RGB as in <tt>bgcolor="#0FF"</tt> does not work with some browsers, it should be #RRGGBB as in <tt>bgcolor="#00FFFF"</tt>.
* [http://www.w3.org/QA/Tips/color Both foreground and background color] should be modified to avoid '''black on black''' effects.
 
Excessive or inappropriate links will be removed.
Popular browsers show links as shades of blue, dark background colors like blue or navy don't work for such links. Using CSS to modify link colors cannot work with legacy browsers. The Netscape 4.x support for CSS is frequently disabled for being as paltry as it is.
 
See [[Wikipedia:External links]] and [[Wikipedia:Spam]] for details.
==References==
<references/>
 
If there are already suitable links, propose additions or replacements on
==See also==
the article's talk page, or submit your link to the relevant category at
* [[List of palettes]]
the Open Directory Project (dmoz.org) and link there using {{Dmoz}}.
* [[X11 color names]]
* [[RGB color space]]
* [[hexadecimal]]
* [[HTML]] and [[Cascading Style Sheets|CSS]]
* [[color]]
* [[RGB color model]]
* [[List of colors|alphabetic list of colors, with samples and codes]]
 
-->
== External links ==
* [http://www.w3.org/TR/CSS21/syndata.html#color-units CSS2.1 Color Specification]
* [http://www.web-colors-explained.com/ Web-Colors-explained.com]
* [http://www.bmk.com.au/cgi-bin/colors.php 4096 web colors & hexadecimal codes] produced by combining 16 shades of each primary color (Red, Green & Blue)
* [http://purl.net/xyzzy/colour.htm XHTML colour names and their sRGB values]
 
{{web colors|state=collapsed}}
{{Color topics|state=collapsed}}
 
[[Category:Web colors| ]]
[[Category:Color]]
[[Category:WorldWeb Wide Web|Colordesign]]
[[Category:Articles with example code]]
 
[[ca:Llista de colors HTML]]
[[da:Web-sikre farver]]
[[de:Farbtabellen im Internet]]
[[el:Διαδικτυακά Χρώματα]]
[[es:Colores HTML]]
[[eu:Wikipedia:Kolorea]]
[[ko:웹 색상]]
[[hu:Színek]]
[[nl:Lijst van HTML-kleuren]]
[[pt:Tripleto hexadecimal]]
[[sv:HTML-färger]]
[[th:สีที่ใช้ในเว็บ]]
[[tr:Web renkleri]]
[[zh:网页颜色模式]]