Author |
Message |
zhhfort2q6i
Forum Master
Joined: 21 Mar 2011
Posts: 36
Read: 0 topics
Location: England
|
|
A CSS color namely both a keyword or a mathematica |
|
ording to the W3C, a CSS color is either a keyword or a numerical specification. That elucidation seems simple. Colors are either keywords or numbers, but it's a bit more complicated than that.
Color Keywords
Color keywords are exactly what you might think they are - a catalogue of words (in English) that correspond to colors aboard Web pages. There are 16 HTML 4 color keywords:
? aqua
? black
? blue
? fuchsia
? gray
? green
? lime
? maroon
? navy
? olive
? purple
? red
? silver
? teal
? white
? yellow
To make things amusing, the W3C reports namely "orange" is also a color keyword in the CSS 2 specification. Perhaps it ambition obtain joined back into CSS 3 before it's finalized.
But it gets extra complicated than that, as there's distinct list of color keywords that you tin use. These colors are constantly called the Netscape Named Colors for the Netscape explorer was the 1st Web explorer to define the color keywords and support them. The W3C calls this list the "SVG Color Keywords". But whatever you shriek it,[link widoczny dla zalogowanych], you need to be scrupulous while you use these keywords. Internet Explorer doesn't favor the alter spellings of gray/grey.
Colors as Numbers
Okay, so color keywords aren't as easy as they appear, but what approximately numbers - that should be fairly uncomplicated, right? Wrong. The CSS 2 specification provides for two ways of clarifying colors as numbers:
? RGB
? Hexadecimal RGB
RGB Color Numbers
The format of an RGB color number is:
rgb(red,green,blue);
The red,green,blue are numerical values from 0 to 255 or percentage values from 0% to 100%. So, the color red is written:
rgb(255,0,0)
rgb(100%,0%,0%)
Hexadecimal Color Numbers
Hexadecimal color numbers are also RGB - they are equitable written differently to allow for distinctions in how browsers handle the CSS.
Hexadecimal colors are the same RGB color numbers converted to base-16 and written as one long number. Hexadecimal to RGB color designs make this cozy to penetrate. They are written:
#RRGGBB
Each couple of the hexadecimal triplet is a number from 00 to FF (base-16), which corresponds to 0 - 255 in decimal. So the color red is written:
#ff0000
CSS 3 Color Numbers
CSS 3 adds some added complexity to the color numbers. In the CSS 3 recommendation, there is:
? the transparent keyword
? RGBA color values
? HSL color values
The perspicuous keyword is no exactly current to CSS 3. CSS 1 allowed background-colors to be marked transparent. Then CSS 2 extended it to the border-color property. CSS 3 extends this keyword to use in any attribute that uses color values including the color attribute for changing text and foreground colors.
An RGBA color value allows you to define the opacity of the color. It is written:
rgba(red,green,blue,opacity)
The final number is an alpha value ranging from 0.0 to 1.0. A color with an alpha value of 0.0 is entirely transparent and an alpha value of 1.0 is fully indistinct. According to the specification, if the user-agent doesn't support RGBA, it ought default to RGB and bypass the alpha value message. However, in practice, this doesn't occur and the color value is completely ignored.
HSL color values refer to hue-saturation-lightness numerical codes for colors. They were additional to solve some specific problems with RGB colors:
? RGB is hardware-oriented. It references CRTs and assumes that color prototype for displaying the colors. Most professional printers are not RGB based, but CMYK and the translation from shade to publish is not all nice.
? RGB is non-intuitive. In additional words, most folk think of colors in reference to the hue (red versus yellow), saturation (grey versus ruddy), or lightness (dark red apt red to pink) but RGB forces you to put the colors in a machine-generated path.
Red in HSL would be written:
hsl(0,[link widoczny dla zalogowanych],100%,50%);
HSL also has an alpha value
The post has been approved 0 times
|
|
Thu 4:27, 05 May 2011 |
|
|
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|