Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Web colors
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==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 |- | style="background:linkText" | || style="font-family: monospace;" | linkText |- | style="background:visitedText" | || style="font-family: monospace;" | visitedText |- | style="background:activeText" | || style="font-family: monospace;" | activeText |- | style="background:highlight" | || style="font-family: monospace;" | highlight |- | style="background:mark" | || style="font-family: monospace;" | mark |} 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/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)