Color in browser engines
Color library ideas
Object.prototype.valueOf
for comparisons
- Maintain registry of CSS2 system colors, currentColor, and color variables to
use when comparing. When not set, they aren’t comparable. A variable is always
equivalent to itself.
- Since
currentColor
is dependent on element, should it ever compare equal?
- Allow loading of CSS2 system colors from browser colors
Engines
Webkit
Functions from CSS source:
Functions from StyleColor.cpp
source:
isCurrentColor
colorFromKeyword
isColorKeyword
isSystemColor
The enum for CSS color keywords and other CSS values is generated by
process-css-values.py
(formerly makevalues.pl),
with data from CSSValueKeywords.in.
Mozilla
Color CSS data type:
- HTML only recognizes the 16 basic color keywords found in CSS1, using a
specific algorithm to convert unrecognized values (often to completely
different colors). The other color keywords should only be used in CSS and
SVG.
- Unlike HTML, CSS will completely ignore unknown keywords.
- The color keywords all represent plain, solid colors, without transparency.
- Several keywords are aliases for each other:
- Though many keywords have been adapted from X11, their RGB values may differ
from the corresponding color on X11 systems since manufacturers sometimes
tailor X11 colors to their specific hardware.
- Also has:
- Mozilla System Color Extensions
- Mozilla Color Preference Extensions
Chrome
Quick Color Management System is used
in Chrome and Firefox.
Blink
CSSWG