1+ https://github.com/kkaefer/css-color-parser-cpp
2+
3+ JavaScript parser for CSS color strings.
4+
5+ > CSSColorParser::parse(" rgba (255, 128, 12, 0.5)");
6+ Color [ 255, 128, 12, 0.5 ]
7+ > CSSColorParser::parse("#fff");
8+ Color [ 255, 255, 255, 1 ]
9+ > CSSColorParser::parse("#ff0011");
10+ Color [ 255, 0, 17, 1 ]
11+ > CSSColorParser::parse("slateblue");
12+ Color [ 106, 90, 205, 1 ]
13+ > CSSColorParser::parse("blah");
14+ Color [ 0, 0, 0, 1 ]
15+ > CSSColorParser::parse("ffffff");
16+ Color [ 0, 0, 0, 1 ]
17+ > CSSColorParser::parse("hsla(900, 15%, 90%, 0.5)")
18+ Color [ 226, 233, 233, 0.5 ]
19+ > CSSColorParser::parse("hsla(900, 15%, 90%)")
20+ Color [ 0, 0, 0, 1 ]
21+ > CSSColorParser::parse("hsl(900, 15%, 90%)")
22+ Color [ 226, 233, 233, 1 ]
23+ > CSSColorParser::parse("hsl(900, 0.15, 90%)") // NOTE: not spec compliant.
24+ Color [ 226, 233, 233, 1 ]
25+
26+
27+ (c) Dean McNamee <dean@gmail.com>, 2012.
28+ (c) Konstantin Käfer <mail@kkaefer.com>, 2014.
29+
30+ Permission is hereby granted, free of charge, to any person obtaining a copy
31+ of this software and associated documentation files (the "Software"), to
32+ deal in the Software without restriction, including without limitation the
33+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
34+ sell copies of the Software, and to permit persons to whom the Software is
35+ furnished to do so, subject to the following conditions:
36+
37+ The above copyright notice and this permission notice shall be included in
38+ all copies or substantial portions of the Software.
39+
40+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
46+ IN THE SOFTWARE.
0 commit comments