chroma-sass 1.0.0.alpha.5 → 1.0.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -25
- data/chroma-sass.gemspec +2 -2
- data/sass/chroma/_colour.scss +11 -77
- data/sass/chroma/_functions.scss +48 -356
- data/sass/chroma/_internals.scss +9 -6
- data/sass/chroma/_kss.scss +160 -13
- data/sass/chroma/_variables.scss +381 -24
- metadata +3 -4
- data/sass/chroma/_kss-styles.scss +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e376ee67d2b82ac4cb331e0e53d57847da5ef4
|
4
|
+
data.tar.gz: 5d0b0134a9f7627338c32a6f74d6528eeba3d5f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a230b25168e748fdc06d8e05ea4381561e081ac3914686af70a208745ab4527a3b48e96f548ff32f25ccdc0282982d41f4ed53a1c9adeb0d6651b5c0ec909d8c
|
7
|
+
data.tar.gz: 3450e20a9a7e430f16aa6e3b3ac3ef617fbab647c2e9b0188a988c29c74942ff4e05cc2c54c7d3115b2be01bdbfc48e66a99877c0b9e92f15b531ca58704ec43
|
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# About Chroma
|
2
2
|
|
3
|
-
WARNING: This is alpha-quality software, so the API is guaranteed to change. But you can always pin your Gemfile to the specific version number you are using.
|
4
|
-
|
5
3
|
Chroma is a Sass library that manages a project's color names, color variations, and color schemes.
|
6
4
|
|
7
5
|
## USAGE
|
@@ -17,13 +15,11 @@ $chroma: define-default-color-scheme('Descriptive color names for use in "functi
|
|
17
15
|
|
18
16
|
// Add colors to the default color scheme.
|
19
17
|
$chroma: add-colors((
|
20
|
-
white:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
blue: #0e71b8,
|
26
|
-
blue-dark: shade(#0e71b8, 25%),
|
18
|
+
white: #fff,
|
19
|
+
grey-medium: #706e6c,
|
20
|
+
black: #000,
|
21
|
+
blue: #0e71b8,
|
22
|
+
red: #c00,
|
27
23
|
));
|
28
24
|
|
29
25
|
// Create a "functional" color scheme that inherits from the default color scheme.
|
@@ -31,21 +27,19 @@ $chroma: define-color-scheme('functional', 'Colors used by functional parts of t
|
|
31
27
|
|
32
28
|
// Add colors to the functional color scheme.
|
33
29
|
$chroma: add-colors('functional', (
|
30
|
+
// Define a primary highlight color.
|
31
|
+
primary: 'blue',
|
32
|
+
|
34
33
|
// Have the "text" color use the hex value given to the "black" color. Even
|
35
34
|
// though the "functional" color scheme doesn't define "black", it inherits
|
36
35
|
// from the "default" color scheme where "black" is defined.
|
37
|
-
text:
|
38
|
-
text-subdued: 'grey-medium',
|
36
|
+
text: 'black',
|
39
37
|
|
40
|
-
//
|
41
|
-
|
38
|
+
// Colors can inherit from colors named earlier in the call to add-colors().
|
39
|
+
heading: 'text',
|
42
40
|
|
43
41
|
// Have the link color use the primary color.
|
44
|
-
link:
|
45
|
-
link-active: 'blue-dark',
|
46
|
-
|
47
|
-
site-name: 'primary',
|
48
|
-
heading: 'text',
|
42
|
+
link: 'primary',
|
49
43
|
));
|
50
44
|
|
51
45
|
// Create an "alternate" color scheme that inherits from the "functional" color scheme.
|
@@ -53,8 +47,7 @@ $chroma: define-color-scheme('alternate', 'Alternate colors for the site.', 'fun
|
|
53
47
|
|
54
48
|
// Add colors to the alternate color scheme.
|
55
49
|
$chroma: add-colors('alternate', (
|
56
|
-
red
|
57
|
-
primary: 'red',
|
50
|
+
primary: 'red',
|
58
51
|
));
|
59
52
|
|
60
53
|
// Set which color scheme should be used by default when calling the color()
|
@@ -72,10 +65,7 @@ $chroma-active-scheme: 'functional';
|
|
72
65
|
|
73
66
|
.alternate-color-section & {
|
74
67
|
// Outputs #c00.
|
75
|
-
color: color(
|
76
|
-
// @TODO: Whoops! This doesn't work yet because it finds the "link" color
|
77
|
-
// value in the functional color scheme and never sees that the primary
|
78
|
-
// color has changed.
|
68
|
+
color: color(alternate, link);
|
79
69
|
}
|
80
70
|
}
|
81
71
|
}
|
@@ -92,7 +82,7 @@ gem install chroma-sass
|
|
92
82
|
If you are using Bundler (and you should!) then you can add it to an existing project by editing the project's Gemfile and adding this line:
|
93
83
|
|
94
84
|
```ruby
|
95
|
-
gem 'chroma-sass', '~> 1.0.0.
|
85
|
+
gem 'chroma-sass', '~> 1.0.0.beta.1'
|
96
86
|
```
|
97
87
|
|
98
88
|
If you are using Compass, edit your project's config.rb and add this line:
|
@@ -114,3 +104,5 @@ You can then start using Chroma in your Sass files. Just add this line to one of
|
|
114
104
|
## LICENSE
|
115
105
|
|
116
106
|
Available under the GPL v2 license. See [LICENSE.txt](https://github.com/JohnAlbin/chroma/blob/master/LICENSE.txt).
|
107
|
+
|
108
|
+
[](https://travis-ci.org/JohnAlbin/chroma)
|
data/chroma-sass.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.homepage = 'http://github.com/JohnAlbin/chroma'
|
10
10
|
spec.rubyforge_project =
|
11
11
|
|
12
|
-
spec.version = '1.0.0.
|
13
|
-
spec.date = '2015-
|
12
|
+
spec.version = '1.0.0.beta.1'
|
13
|
+
spec.date = '2015-05-05'
|
14
14
|
spec.licenses = ['GPL-2']
|
15
15
|
|
16
16
|
spec.authors = ['John Albin Wilkins']
|
data/sass/chroma/_colour.scss
CHANGED
@@ -1,20 +1,19 @@
|
|
1
|
+
// Colour module
|
1
2
|
//
|
2
|
-
//
|
3
|
+
// An optional module for Chroma that uses "colour" instead of "color" in all
|
4
|
+
// its variables and functions.
|
3
5
|
//
|
6
|
+
// Style guide: colour
|
4
7
|
|
5
8
|
// Import the main module of Chroma.
|
6
9
|
@import './functions';
|
7
10
|
|
8
11
|
// The one true spelling.
|
9
|
-
$
|
10
|
-
|
12
|
+
$_chroma-spelling: 'colour';
|
11
13
|
|
12
14
|
// is-dangerous-colour-keyword($name)
|
13
15
|
//
|
14
|
-
//
|
15
|
-
// containing the name of the colour keyword.
|
16
|
-
//
|
17
|
-
// $name - The name of the colour to check.
|
16
|
+
// See `is-dangerous-color-keyword()` for the documentation.
|
18
17
|
//
|
19
18
|
// Style guide: colour.is-dangerous-colour-keyword
|
20
19
|
@function is-dangerous-colour-keyword($name) {
|
@@ -23,10 +22,7 @@ $chroma-spelling : 'colour';
|
|
23
22
|
|
24
23
|
// is-colour-keyword($name)
|
25
24
|
//
|
26
|
-
//
|
27
|
-
// containing the name of the colour keyword.
|
28
|
-
//
|
29
|
-
// $name - The name of the colour to check.
|
25
|
+
// See `is-color-keyword()` for the documentation.
|
30
26
|
//
|
31
27
|
// Style guide: colour.is-colour-keyword
|
32
28
|
@function is-colour-keyword($name) {
|
@@ -35,21 +31,7 @@ $chroma-spelling : 'colour';
|
|
35
31
|
|
36
32
|
// colour([$scheme,] $name)
|
37
33
|
//
|
38
|
-
//
|
39
|
-
// named colour is not in the colour scheme, the colour scheme's parent scheme will
|
40
|
-
// be searched.
|
41
|
-
//
|
42
|
-
// Usage:
|
43
|
-
// ```scss
|
44
|
-
// .ex {
|
45
|
-
// background-color: colour(body-bg);
|
46
|
-
// border: 1px solid colour(grace, border);
|
47
|
-
// }
|
48
|
-
// ```
|
49
|
-
//
|
50
|
-
// $name - The name of the requested colour.
|
51
|
-
// $scheme - Optional colour scheme to choose from; defaults to
|
52
|
-
// `$chroma-active-scheme`.
|
34
|
+
// See `color()` for the documentation.
|
53
35
|
//
|
54
36
|
// Style guide: colour.colour
|
55
37
|
@function colour($scheme, $name: null) {
|
@@ -58,27 +40,7 @@ $chroma-spelling : 'colour';
|
|
58
40
|
|
59
41
|
// define-colour-scheme($scheme [, $description] [, $parent])
|
60
42
|
//
|
61
|
-
//
|
62
|
-
// colour scheme.
|
63
|
-
//
|
64
|
-
// When searching for a colour and the colour scheme does not define that
|
65
|
-
// particular colour, the parent colour scheme will be checked to see if it
|
66
|
-
// defines that colour.
|
67
|
-
//
|
68
|
-
// By default, all colour schemes inherit their colours from the default colour
|
69
|
-
// scheme. Optionally, a colour scheme can choose to inherit from a different
|
70
|
-
// colour scheme by specifying the `$parent` parameter.
|
71
|
-
//
|
72
|
-
// Usage:
|
73
|
-
// ```scss
|
74
|
-
// $chroma: define-colour-scheme(taiwan, "Taiwan's colours");
|
75
|
-
// $chroma: define-colour-scheme(taipei, "Taipei's colours", $parent: taiwan);
|
76
|
-
// ```
|
77
|
-
//
|
78
|
-
// $scheme - The name of the new colour scheme.
|
79
|
-
// $description - Optional description of the colour scheme.
|
80
|
-
// $parent - The parent colour scheme to inherit colours from; defaults to
|
81
|
-
// `default` (i.e. `$CHROMA_DEFAULT_SCHEME`).
|
43
|
+
// See `define-color-scheme()` for the documentation.
|
82
44
|
//
|
83
45
|
// Style guide: colour.define-colour-scheme
|
84
46
|
@function define-colour-scheme($scheme, $description: '', $parent: $CHROMA_DEFAULT_SCHEME) {
|
@@ -87,14 +49,7 @@ $chroma-spelling : 'colour';
|
|
87
49
|
|
88
50
|
// define-default-colour-scheme($description)
|
89
51
|
//
|
90
|
-
//
|
91
|
-
//
|
92
|
-
// Usage:
|
93
|
-
// ```scss
|
94
|
-
// $chroma: define-default-colour-scheme('Default colours');
|
95
|
-
// ```
|
96
|
-
//
|
97
|
-
// $description - Description of the default colour scheme.
|
52
|
+
// See `define-default-color-scheme()` for the documentation.
|
98
53
|
//
|
99
54
|
// Style guide: colour.define-default-colour-scheme
|
100
55
|
@function define-default-colour-scheme($description) {
|
@@ -103,28 +58,7 @@ $chroma-spelling : 'colour';
|
|
103
58
|
|
104
59
|
// add-colours([$scheme,] $colours)
|
105
60
|
//
|
106
|
-
//
|
107
|
-
//
|
108
|
-
// Usage:
|
109
|
-
// ```scss
|
110
|
-
// $my-colours: add-colours('admiral', (
|
111
|
-
// nav: 'link',
|
112
|
-
// nav-visited: colour(link-visited),
|
113
|
-
// nav-focus: colour(link-focus),
|
114
|
-
// ));
|
115
|
-
// ```
|
116
|
-
//
|
117
|
-
// If you wish to add colours to the active scheme, you can just use:
|
118
|
-
// ```scss
|
119
|
-
// $my-colours: add-colours((
|
120
|
-
// nav: 'link',
|
121
|
-
// nav-visited: colour(link-visited),
|
122
|
-
// nav-focus: colour(link-focus),
|
123
|
-
// ));
|
124
|
-
// ```
|
125
|
-
//
|
126
|
-
// $colours - A Sass map containing the new colours.
|
127
|
-
// $scheme - The name of an existing colour scheme.
|
61
|
+
// See `add-colors()` for the documentation.
|
128
62
|
//
|
129
63
|
// Style guide: functions.add-colours
|
130
64
|
@function add-colours($scheme, $colours: null) {
|
data/sass/chroma/_functions.scss
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
// Functions module
|
1
2
|
//
|
2
|
-
//
|
3
|
+
// The main module for Chroma.
|
3
4
|
//
|
5
|
+
// Style guide: functions
|
4
6
|
|
5
7
|
// Import the global variables and internal functions needed by all of Chroma.
|
6
8
|
@import './variables';
|
@@ -12,71 +14,47 @@ $chroma: _chroma-init();
|
|
12
14
|
|
13
15
|
// is-dangerous-color-keyword($name)
|
14
16
|
//
|
17
|
+
// This function is used by color(), add-colors() and others to check if the
|
18
|
+
// given color name is a "dangerous" color keyword. Returns false or causes the
|
19
|
+
// Sass compilation to die with an error message containing the name of the
|
20
|
+
// dangerous color keyword.
|
21
|
+
//
|
15
22
|
// If a real Sass color is given as a color name to Chroma, it is in danger of
|
16
|
-
// being converted to a hexadecimal value before Chroma can read the name.
|
17
|
-
//
|
23
|
+
// being converted to a hexadecimal value before Chroma can read the name. (This
|
24
|
+
// happens when Sass' "compressed" output style is used.) And some hex values
|
25
|
+
// map to more than one keyword (e.g. gray/grey and fuchsia/magenta), so the
|
18
26
|
// original name would be irretrievable.
|
19
27
|
//
|
20
|
-
//
|
21
|
-
//
|
22
|
-
//
|
28
|
+
// Since Chroma will confuse fuchsia and magenta (among others) under Sass'
|
29
|
+
// "compressed" output style, it would generate confusing results. To prevent
|
30
|
+
// this, Chroma halts Sass compilation when it detects an ambiguous color
|
31
|
+
// keyword. While the error only occurs under Sass' "compressed" output style,
|
32
|
+
// Chroma halts under all output styles. Otherwise, Chroma could behave
|
33
|
+
// differently on production vs. development environments. If you are really
|
34
|
+
// sure Chroma will never be run with Sass' "compressed" output style, you can
|
35
|
+
// disable this feature by setting `$chroma-die-on-dangerous-keyword: false;`.
|
23
36
|
//
|
24
37
|
// $name - The name of the color to check.
|
25
38
|
//
|
26
39
|
// Style guide: functions.is-dangerous-color-keyword
|
27
40
|
@function is-dangerous-color-keyword($name) {
|
28
|
-
$ambiguous-keywords: (
|
29
|
-
'aqua': 'aqua or cyan',
|
30
|
-
'cyan': 'aqua or cyan',
|
31
|
-
'fuchsia': 'fuchsia or magenta',
|
32
|
-
'magenta': 'fuchsia or magenta',
|
33
|
-
'darkgray': 'darkgray or darkgrey',
|
34
|
-
'darkgrey': 'darkgray or darkgrey',
|
35
|
-
'darkslategray': 'darkslategray or darkslategrey',
|
36
|
-
'darkslategrey': 'darkslategray or darkslategrey',
|
37
|
-
'dimgray': 'dimgray or dimgrey',
|
38
|
-
'dimgrey': 'dimgray or dimgrey',
|
39
|
-
'gray': 'gray or grey',
|
40
|
-
'grey': 'gray or grey',
|
41
|
-
'lightgray': 'lightgray or lightgrey',
|
42
|
-
'lightgrey': 'lightgray or lightgrey',
|
43
|
-
'lightslategray': 'lightslategray or lightslategrey',
|
44
|
-
'lightslategrey': 'lightslategray or lightslategrey',
|
45
|
-
'slategray': 'slategray or slategrey',
|
46
|
-
'slategrey': 'slategray or slategrey',
|
47
|
-
);
|
48
|
-
$converted-keywords: (
|
49
|
-
'#00ffff': 'aqua or cyan',
|
50
|
-
'#0ff': 'aqua or cyan',
|
51
|
-
'#ff00ff': 'fuchsia or magenta',
|
52
|
-
'#f0f': 'fuchsia or magenta',
|
53
|
-
'#a9a9a9': 'darkgray or darkgrey',
|
54
|
-
'#2f4f4f': 'darkslategray or darkslategrey',
|
55
|
-
'#696969': 'dimgray or dimgrey',
|
56
|
-
'#808080': 'gray or grey',
|
57
|
-
'#d3d3d3': 'lightgray or lightgrey',
|
58
|
-
'#778899': 'lightslategray or lightslategrey',
|
59
|
-
'#789': 'lightslategray or lightslategrey',
|
60
|
-
'#708090': 'slategray or slategrey',
|
61
|
-
);
|
62
|
-
|
63
41
|
@if type-of($name) == 'color' {
|
64
42
|
// Convert the color to a string.
|
65
43
|
$name: inspect($name);
|
66
44
|
// Check if Sass will convert the color into a hex value that we can't
|
67
45
|
// convert back to a keyword.
|
68
|
-
@if map-has-key($
|
69
|
-
@if $chroma-die-on-
|
70
|
-
@error "Sass will convert #{$name} into a hexidecimal value when it uses the \"compressed\" output style and Chroma will not be able to determine if the original name was #{map-get($
|
46
|
+
@if map-has-key($_chroma-dangerous-keywords, $name) {
|
47
|
+
@if $chroma-die-on-dangerous-keyword {
|
48
|
+
@error "Sass will convert #{$name} into a hexidecimal value when it uses the \"compressed\" output style and Chroma will not be able to determine if the original name was #{map-get($_chroma-dangerous-keywords, $name)}. To prevent this error, quote the keyword like this: '#{$name}'.";
|
71
49
|
}
|
72
50
|
@else {
|
73
|
-
@return map-get($
|
51
|
+
@return map-get($_chroma-dangerous-keywords, $name);
|
74
52
|
}
|
75
53
|
}
|
76
54
|
// Check if Sass _has_ converted the color into a hex value that we can't
|
77
55
|
// convert back to a keyword.
|
78
|
-
@else if map-has-key($converted-keywords, $name) {
|
79
|
-
@error "Sass has converted a color keyword into the hexidecimal value, #{$name}, and Chroma was not be able to determine if the original name was #{map-get($
|
56
|
+
@else if map-has-key($_chroma-dangerous-converted-keywords, $name) {
|
57
|
+
@error "Sass has converted a color keyword into the hexidecimal value, #{$name}, and Chroma was not be able to determine if the original name was #{map-get($_chroma-dangerous-converted-keywords, $name)}. To prevent this error, use quotes around the keyword.";
|
80
58
|
}
|
81
59
|
}
|
82
60
|
@return false;
|
@@ -99,311 +77,10 @@ $chroma: _chroma-init();
|
|
99
77
|
// If true, the is-dangerous-color-keyword() would @die before it returned.
|
100
78
|
}
|
101
79
|
|
102
|
-
// CSS4 color keyword are from
|
103
|
-
// http://dev.w3.org/csswg/css-color-4/#named-colors
|
104
|
-
$css4-color-keywords: (
|
105
|
-
'aliceblue': 'aliceblue',
|
106
|
-
'#f0f8ff': 'aliceblue',
|
107
|
-
'antiquewhite': 'antiquewhite',
|
108
|
-
'#faebd7': 'antiquewhite',
|
109
|
-
'aqua': 'aqua',
|
110
|
-
'aquamarine': 'aquamarine',
|
111
|
-
'#7fffd4': 'aquamarine',
|
112
|
-
'azure': 'azure',
|
113
|
-
'#f0ffff': 'azure',
|
114
|
-
'beige': 'beige',
|
115
|
-
'#f5f5dc': 'beige',
|
116
|
-
'bisque': 'bisque',
|
117
|
-
'#ffe4c4': 'bisque',
|
118
|
-
'black': 'black',
|
119
|
-
'#000000': 'black',
|
120
|
-
'#000': 'black',
|
121
|
-
'blanchedalmond': 'blanchedalmond',
|
122
|
-
'#ffebcd': 'blanchedalmond',
|
123
|
-
'blue': 'blue',
|
124
|
-
'#0000ff': 'blue',
|
125
|
-
'#00f': 'blue',
|
126
|
-
'blueviolet': 'blueviolet',
|
127
|
-
'#8a2be2': 'blueviolet',
|
128
|
-
'brown': 'brown',
|
129
|
-
'#a52a2a': 'brown',
|
130
|
-
'burlywood': 'burlywood',
|
131
|
-
'#deb887': 'burlywood',
|
132
|
-
'cadetblue': 'cadetblue',
|
133
|
-
'#5f9ea0': 'cadetblue',
|
134
|
-
'chartreuse': 'chartreuse',
|
135
|
-
'#7fff00': 'chartreuse',
|
136
|
-
'chocolate': 'chocolate',
|
137
|
-
'#d2691e': 'chocolate',
|
138
|
-
'coral': 'coral',
|
139
|
-
'#ff7f50': 'coral',
|
140
|
-
'cornflowerblue': 'cornflowerblue',
|
141
|
-
'#6495ed': 'cornflowerblue',
|
142
|
-
'cornsilk': 'cornsilk',
|
143
|
-
'#fff8dc': 'cornsilk',
|
144
|
-
'crimson': 'crimson',
|
145
|
-
'#dc143c': 'crimson',
|
146
|
-
'cyan': 'cyan',
|
147
|
-
'#00ffff': 'cyan',
|
148
|
-
'#0ff': 'cyan',
|
149
|
-
'darkblue': 'darkblue',
|
150
|
-
'#00008b': 'darkblue',
|
151
|
-
'darkcyan': 'darkcyan',
|
152
|
-
'#008b8b': 'darkcyan',
|
153
|
-
'darkgoldenrod': 'darkgoldenrod',
|
154
|
-
'#b8860b': 'darkgoldenrod',
|
155
|
-
'darkgray': 'darkgray',
|
156
|
-
'#a9a9a9': 'darkgray',
|
157
|
-
'darkgreen': 'darkgreen',
|
158
|
-
'#006400': 'darkgreen',
|
159
|
-
'darkgrey': 'darkgrey',
|
160
|
-
'darkkhaki': 'darkkhaki',
|
161
|
-
'#bdb76b': 'darkkhaki',
|
162
|
-
'darkmagenta': 'darkmagenta',
|
163
|
-
'#8b008b': 'darkmagenta',
|
164
|
-
'darkolivegreen': 'darkolivegreen',
|
165
|
-
'#556b2f': 'darkolivegreen',
|
166
|
-
'darkorange': 'darkorange',
|
167
|
-
'#ff8c00': 'darkorange',
|
168
|
-
'darkorchid': 'darkorchid',
|
169
|
-
'#9932cc': 'darkorchid',
|
170
|
-
'darkred': 'darkred',
|
171
|
-
'#8b0000': 'darkred',
|
172
|
-
'darksalmon': 'darksalmon',
|
173
|
-
'#e9967a': 'darksalmon',
|
174
|
-
'darkseagreen': 'darkseagreen',
|
175
|
-
'#8fbc8f': 'darkseagreen',
|
176
|
-
'darkslateblue': 'darkslateblue',
|
177
|
-
'#483d8b': 'darkslateblue',
|
178
|
-
'darkslategray': 'darkslategray',
|
179
|
-
'#2f4f4f': 'darkslategray',
|
180
|
-
'darkslategrey': 'darkslategrey',
|
181
|
-
'darkturquoise': 'darkturquoise',
|
182
|
-
'#00ced1': 'darkturquoise',
|
183
|
-
'darkviolet': 'darkviolet',
|
184
|
-
'#9400d3': 'darkviolet',
|
185
|
-
'deeppink': 'deeppink',
|
186
|
-
'#ff1493': 'deeppink',
|
187
|
-
'deepskyblue': 'deepskyblue',
|
188
|
-
'#00bfff': 'deepskyblue',
|
189
|
-
'dimgray': 'dimgray',
|
190
|
-
'#696969': 'dimgray',
|
191
|
-
'dimgrey': 'dimgrey',
|
192
|
-
'dodgerblue': 'dodgerblue',
|
193
|
-
'#1e90ff': 'dodgerblue',
|
194
|
-
'firebrick': 'firebrick',
|
195
|
-
'#b22222': 'firebrick',
|
196
|
-
'floralwhite': 'floralwhite',
|
197
|
-
'#fffaf0': 'floralwhite',
|
198
|
-
'forestgreen': 'forestgreen',
|
199
|
-
'#228b22': 'forestgreen',
|
200
|
-
'fuchsia': 'fuchsia',
|
201
|
-
'gainsboro': 'gainsboro',
|
202
|
-
'#dcdcdc': 'gainsboro',
|
203
|
-
'ghostwhite': 'ghostwhite',
|
204
|
-
'#f8f8ff': 'ghostwhite',
|
205
|
-
'gold': 'gold',
|
206
|
-
'#ffd700': 'gold',
|
207
|
-
'goldenrod': 'goldenrod',
|
208
|
-
'#daa520': 'goldenrod',
|
209
|
-
'gray': 'gray',
|
210
|
-
'#808080': 'gray',
|
211
|
-
'green': 'green',
|
212
|
-
'#008000': 'green',
|
213
|
-
'greenyellow': 'greenyellow',
|
214
|
-
'#adff2f': 'greenyellow',
|
215
|
-
'grey': 'grey',
|
216
|
-
'honeydew': 'honeydew',
|
217
|
-
'#f0fff0': 'honeydew',
|
218
|
-
'hotpink': 'hotpink',
|
219
|
-
'#ff69b4': 'hotpink',
|
220
|
-
'indianred': 'indianred',
|
221
|
-
'#cd5c5c': 'indianred',
|
222
|
-
'indigo': 'indigo',
|
223
|
-
'#4b0082': 'indigo',
|
224
|
-
'ivory': 'ivory',
|
225
|
-
'#fffff0': 'ivory',
|
226
|
-
'khaki': 'khaki',
|
227
|
-
'#f0e68c': 'khaki',
|
228
|
-
'lavender': 'lavender',
|
229
|
-
'#e6e6fa': 'lavender',
|
230
|
-
'lavenderblush': 'lavenderblush',
|
231
|
-
'#fff0f5': 'lavenderblush',
|
232
|
-
'lawngreen': 'lawngreen',
|
233
|
-
'#7cfc00': 'lawngreen',
|
234
|
-
'lemonchiffon': 'lemonchiffon',
|
235
|
-
'#fffacd': 'lemonchiffon',
|
236
|
-
'lightblue': 'lightblue',
|
237
|
-
'#add8e6': 'lightblue',
|
238
|
-
'lightcoral': 'lightcoral',
|
239
|
-
'#f08080': 'lightcoral',
|
240
|
-
'lightcyan': 'lightcyan',
|
241
|
-
'#e0ffff': 'lightcyan',
|
242
|
-
'lightgoldenrodyellow': 'lightgoldenrodyellow',
|
243
|
-
'#fafad2': 'lightgoldenrodyellow',
|
244
|
-
'lightgray': 'lightgray',
|
245
|
-
'#d3d3d3': 'lightgray',
|
246
|
-
'lightgreen': 'lightgreen',
|
247
|
-
'#90ee90': 'lightgreen',
|
248
|
-
'lightgrey': 'lightgrey',
|
249
|
-
'lightpink': 'lightpink',
|
250
|
-
'#ffb6c1': 'lightpink',
|
251
|
-
'lightsalmon': 'lightsalmon',
|
252
|
-
'#ffa07a': 'lightsalmon',
|
253
|
-
'lightseagreen': 'lightseagreen',
|
254
|
-
'#20b2aa': 'lightseagreen',
|
255
|
-
'lightskyblue': 'lightskyblue',
|
256
|
-
'#87cefa': 'lightskyblue',
|
257
|
-
'lightslategray': 'lightslategray',
|
258
|
-
'#778899': 'lightslategray',
|
259
|
-
'#789': 'lightslategray',
|
260
|
-
'lightslategrey': 'lightslategrey',
|
261
|
-
'lightsteelblue': 'lightsteelblue',
|
262
|
-
'#b0c4de': 'lightsteelblue',
|
263
|
-
'lightyellow': 'lightyellow',
|
264
|
-
'#ffffe0': 'lightyellow',
|
265
|
-
'lime': 'lime',
|
266
|
-
'#00ff00': 'lime',
|
267
|
-
'#0f0': 'lime',
|
268
|
-
'limegreen': 'limegreen',
|
269
|
-
'#32cd32': 'limegreen',
|
270
|
-
'linen': 'linen',
|
271
|
-
'#faf0e6': 'linen',
|
272
|
-
'magenta': 'magenta',
|
273
|
-
'#ff00ff': 'magenta',
|
274
|
-
'#f0f': 'magenta',
|
275
|
-
'maroon': 'maroon',
|
276
|
-
'#800000': 'maroon',
|
277
|
-
'mediumaquamarine': 'mediumaquamarine',
|
278
|
-
'#66cdaa': 'mediumaquamarine',
|
279
|
-
'mediumblue': 'mediumblue',
|
280
|
-
'#0000cd': 'mediumblue',
|
281
|
-
'mediumorchid': 'mediumorchid',
|
282
|
-
'#ba55d3': 'mediumorchid',
|
283
|
-
'mediumpurple': 'mediumpurple',
|
284
|
-
'#9370db': 'mediumpurple',
|
285
|
-
'mediumseagreen': 'mediumseagreen',
|
286
|
-
'#3cb371': 'mediumseagreen',
|
287
|
-
'mediumslateblue': 'mediumslateblue',
|
288
|
-
'#7b68ee': 'mediumslateblue',
|
289
|
-
'mediumspringgreen': 'mediumspringgreen',
|
290
|
-
'#00fa9a': 'mediumspringgreen',
|
291
|
-
'mediumturquoise': 'mediumturquoise',
|
292
|
-
'#48d1cc': 'mediumturquoise',
|
293
|
-
'mediumvioletred': 'mediumvioletred',
|
294
|
-
'#c71585': 'mediumvioletred',
|
295
|
-
'midnightblue': 'midnightblue',
|
296
|
-
'#191970': 'midnightblue',
|
297
|
-
'mintcream': 'mintcream',
|
298
|
-
'#f5fffa': 'mintcream',
|
299
|
-
'mistyrose': 'mistyrose',
|
300
|
-
'#ffe4e1': 'mistyrose',
|
301
|
-
'moccasin': 'moccasin',
|
302
|
-
'#ffe4b5': 'moccasin',
|
303
|
-
'navajowhite': 'navajowhite',
|
304
|
-
'#ffdead': 'navajowhite',
|
305
|
-
'navy': 'navy',
|
306
|
-
'#000080': 'navy',
|
307
|
-
'oldlace': 'oldlace',
|
308
|
-
'#fdf5e6': 'oldlace',
|
309
|
-
'olive': 'olive',
|
310
|
-
'#808000': 'olive',
|
311
|
-
'olivedrab': 'olivedrab',
|
312
|
-
'#6b8e23': 'olivedrab',
|
313
|
-
'orange': 'orange',
|
314
|
-
'#ffa500': 'orange',
|
315
|
-
'orangered': 'orangered',
|
316
|
-
'#ff4500': 'orangered',
|
317
|
-
'orchid': 'orchid',
|
318
|
-
'#da70d6': 'orchid',
|
319
|
-
'palegoldenrod': 'palegoldenrod',
|
320
|
-
'#eee8aa': 'palegoldenrod',
|
321
|
-
'palegreen': 'palegreen',
|
322
|
-
'#98fb98': 'palegreen',
|
323
|
-
'paleturquoise': 'paleturquoise',
|
324
|
-
'#afeeee': 'paleturquoise',
|
325
|
-
'palevioletred': 'palevioletred',
|
326
|
-
'#db7093': 'palevioletred',
|
327
|
-
'papayawhip': 'papayawhip',
|
328
|
-
'#ffefd5': 'papayawhip',
|
329
|
-
'peachpuff': 'peachpuff',
|
330
|
-
'#ffdab9': 'peachpuff',
|
331
|
-
'peru': 'peru',
|
332
|
-
'#cd853f': 'peru',
|
333
|
-
'pink': 'pink',
|
334
|
-
'#ffc0cb': 'pink',
|
335
|
-
'plum': 'plum',
|
336
|
-
'#dda0dd': 'plum',
|
337
|
-
'powderblue': 'powderblue',
|
338
|
-
'#b0e0e6': 'powderblue',
|
339
|
-
'purple': 'purple',
|
340
|
-
'#800080': 'purple',
|
341
|
-
'rebeccapurple': 'rebeccapurple',
|
342
|
-
'#663399': 'rebeccapurple',
|
343
|
-
'red': 'red',
|
344
|
-
'#ff0000': 'red',
|
345
|
-
'#f00': 'red',
|
346
|
-
'rosybrown': 'rosybrown',
|
347
|
-
'#bc8f8f': 'rosybrown',
|
348
|
-
'royalblue': 'royalblue',
|
349
|
-
'#4169e1': 'royalblue',
|
350
|
-
'saddlebrown': 'saddlebrown',
|
351
|
-
'#8b4513': 'saddlebrown',
|
352
|
-
'salmon': 'salmon',
|
353
|
-
'#fa8072': 'salmon',
|
354
|
-
'sandybrown': 'sandybrown',
|
355
|
-
'#f4a460': 'sandybrown',
|
356
|
-
'seagreen': 'seagreen',
|
357
|
-
'#2e8b57': 'seagreen',
|
358
|
-
'seashell': 'seashell',
|
359
|
-
'#fff5ee': 'seashell',
|
360
|
-
'sienna': 'sienna',
|
361
|
-
'#a0522d': 'sienna',
|
362
|
-
'silver': 'silver',
|
363
|
-
'#c0c0c0': 'silver',
|
364
|
-
'skyblue': 'skyblue',
|
365
|
-
'#87ceeb': 'skyblue',
|
366
|
-
'slateblue': 'slateblue',
|
367
|
-
'#6a5acd': 'slateblue',
|
368
|
-
'slategray': 'slategray',
|
369
|
-
'#708090': 'slategray',
|
370
|
-
'slategrey': 'slategrey',
|
371
|
-
'snow': 'snow',
|
372
|
-
'#fffafa': 'snow',
|
373
|
-
'springgreen': 'springgreen',
|
374
|
-
'#00ff7f': 'springgreen',
|
375
|
-
'steelblue': 'steelblue',
|
376
|
-
'#4682b4': 'steelblue',
|
377
|
-
'tan': 'tan',
|
378
|
-
'#d2b48c': 'tan',
|
379
|
-
'teal': 'teal',
|
380
|
-
'#008080': 'teal',
|
381
|
-
'thistle': 'thistle',
|
382
|
-
'#d8bfd8': 'thistle',
|
383
|
-
'tomato': 'tomato',
|
384
|
-
'#ff6347': 'tomato',
|
385
|
-
'turquoise': 'turquoise',
|
386
|
-
'#40e0d0': 'turquoise',
|
387
|
-
'violet': 'violet',
|
388
|
-
'#ee82ee': 'violet',
|
389
|
-
'wheat': 'wheat',
|
390
|
-
'#f5deb3': 'wheat',
|
391
|
-
'white': 'white',
|
392
|
-
'#ffffff': 'white',
|
393
|
-
'#fff': 'white',
|
394
|
-
'whitesmoke': 'whitesmoke',
|
395
|
-
'#f5f5f5': 'whitesmoke',
|
396
|
-
'yellow': 'yellow',
|
397
|
-
'#ffff00': 'yellow',
|
398
|
-
'#ff0': 'yellow',
|
399
|
-
'yellowgreen': 'yellowgreen',
|
400
|
-
'#9acd32': 'yellowgreen',
|
401
|
-
);
|
402
|
-
|
403
80
|
// Convert the color to a string.
|
404
81
|
$name: inspect($name);
|
405
82
|
|
406
|
-
@return if(map-has-key($css4-color-keywords, $name), map-get($css4-color-keywords, $name), false);
|
83
|
+
@return if(map-has-key($_chroma-css4-color-keywords, $name), map-get($_chroma-css4-color-keywords, $name), false);
|
407
84
|
}
|
408
85
|
|
409
86
|
// chroma-to-string($name)
|
@@ -449,7 +126,7 @@ $chroma: _chroma-init();
|
|
449
126
|
|
450
127
|
// Confirm the scheme exists.
|
451
128
|
@if not chroma-has-scheme($scheme) {
|
452
|
-
@error 'The #{$
|
129
|
+
@error 'The #{$_chroma-spelling} scheme "#{$scheme}" was not found.';
|
453
130
|
}
|
454
131
|
// Cast the color name to a string to ensure color keywords do not cause
|
455
132
|
// problems as map keys.
|
@@ -457,9 +134,24 @@ $chroma: _chroma-init();
|
|
457
134
|
// Find the actual scheme used by the named color.
|
458
135
|
$actual-scheme: chroma-has-color($name, $scheme);
|
459
136
|
@if not $actual-scheme {
|
460
|
-
@error 'The #{$
|
137
|
+
@error 'The #{$_chroma-spelling} "#{$name}" was not found.';
|
138
|
+
}
|
139
|
+
$color: map-get(map-get($chroma, 'names'), "#{$actual-scheme}::#{$name}");
|
140
|
+
@if $actual-scheme == $scheme {
|
141
|
+
@return map-get($color, 'value');
|
142
|
+
}
|
143
|
+
@else {
|
144
|
+
// The value of $actual-scheme::$name is based on parents in $actual-scheme.
|
145
|
+
// But one or more of the parents may be defined in $scheme too, so we need
|
146
|
+
// to check the full reference chain.
|
147
|
+
$ref: map-get($color, 'reference');
|
148
|
+
@while $ref {
|
149
|
+
$actual-scheme: chroma-has-color($ref, $scheme);
|
150
|
+
$color: map-get(map-get($chroma, 'names'), "#{$actual-scheme}::#{$ref}");
|
151
|
+
$ref: map-get($color, 'reference');
|
152
|
+
}
|
153
|
+
@return map-get($color, 'value');
|
461
154
|
}
|
462
|
-
@return map-get(map-get(map-get($chroma, 'names'), "#{$actual-scheme}::#{$name}"), 'value');
|
463
155
|
}
|
464
156
|
|
465
157
|
// define-color-scheme($scheme [, $description] [, $parent])
|
@@ -495,7 +187,7 @@ $chroma: _chroma-init();
|
|
495
187
|
|
496
188
|
// Check parent reference exists.
|
497
189
|
@if $parent and not chroma-has-scheme($parent) {
|
498
|
-
@error 'Cannot set the parent of #{scheme} to "#{$parent}" because the #{$
|
190
|
+
@error 'Cannot set the parent of #{scheme} to "#{$parent}" because the #{$_chroma-spelling} scheme "#{$parent}" was not found.';
|
499
191
|
}
|
500
192
|
|
501
193
|
$schemes: map-merge(
|
@@ -564,7 +256,7 @@ $chroma: _chroma-init();
|
|
564
256
|
$scheme: $chroma-active-scheme;
|
565
257
|
}
|
566
258
|
@if not chroma-has-scheme($scheme) {
|
567
|
-
@error 'The #{$
|
259
|
+
@error 'The #{$_chroma-spelling} scheme "#{$scheme}" was not found.';
|
568
260
|
}
|
569
261
|
@each $color-name, $color-value in $colors {
|
570
262
|
// Cast the color name to a string to ensure color keywords do not cause
|
@@ -584,7 +276,7 @@ $chroma: _chroma-init();
|
|
584
276
|
// Find the referenced color.
|
585
277
|
$scheme-of-reference: chroma-has-color($ref, $scheme);
|
586
278
|
@if not $scheme-of-reference {
|
587
|
-
@error 'The #{$
|
279
|
+
@error 'The #{$_chroma-spelling} "#{$ref}" was not found.';
|
588
280
|
}
|
589
281
|
$referenced-color: map-get(map-get($chroma, 'names'), "#{$scheme-of-reference}::#{$ref}");
|
590
282
|
// Add the new color.
|
@@ -605,7 +297,7 @@ $chroma: _chroma-init();
|
|
605
297
|
) !global;
|
606
298
|
$ref: map-get($referenced-color, 'reference');
|
607
299
|
@if $ref {
|
608
|
-
$scheme-of-reference: chroma-has-color($ref, $scheme
|
300
|
+
$scheme-of-reference: chroma-has-color($ref, $scheme);
|
609
301
|
$referenced-color: map-get(map-get($chroma, 'names'), "#{$scheme-of-reference}::#{$ref}");
|
610
302
|
}
|
611
303
|
}
|