sass-color-schemes 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 092075af671c7f8422c9d5d4d5958787d5086436
4
+ data.tar.gz: 4567e52a8b37a22edeba60bc81a096ea3723491d
5
+ SHA512:
6
+ metadata.gz: be61f2ba4994195ffb0d0b069e5ff13aa25cbc455026a435d514aaca150a6876199fec0fd68a6baed7826d25a1da6121cf9a4659c1a64e6c4698ef75a626ebb5
7
+ data.tar.gz: d4db49a72db0ba1fe0b65552a0faef393b75fc46015fc337fa5b829981f70a1eea07c9a51352bae469ec32596f4792b096cc95aaff9460a81cd7216fb223dfe1
data/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # Sass-color-schemes
2
+
3
+ This [Compass](compass-style.org) extension makes it easy to use color schemes in your web pages by providing a collection of colors based on one (base-) color which is supplemented with additional colors to make the best visual impression.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sass-color-schemes'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sass-color-schemes
20
+
21
+ ## Usage
22
+
23
+ Import it into your main stylesheet:
24
+
25
+ @import 'sass-color-schemes';
26
+
27
+ ### Color functions
28
+
29
+ Sass-color-schemes has 4 functions that all return an array of 5 color values (of 5 `null`'s). Each function uses variables, such as `$base-color`, `$variation`, etc. for calculating the proper values.
30
+
31
+ See **variables** for a description of the different kinds.
32
+
33
+ #### primary-colors
34
+
35
+ Returns an array of 5 colors, in which the first element is the base color and the rest are different shades of the base color. You need the Sass' `nth` function to access a specific color:
36
+
37
+ ```
38
+ $color-primary-0: nth(primary-colors(), 1);
39
+ $color-primary-1: nth(primary-colors(), 2);
40
+ // ... etc.
41
+
42
+ .title {
43
+ color: $color-primary-0;
44
+ }
45
+
46
+ .subtitle {
47
+ color: $color-primary-1;
48
+ }
49
+
50
+ ```
51
+
52
+ #### complement-colors
53
+
54
+ Returns an array of 5 colors, in which the first element is the complementary color of base color and the rest are different shades of this complementary color. You need the Sass' `nth` function to access a specific color:
55
+
56
+
57
+ ```
58
+ $color-complement-0: nth(complement-colors(), 1);
59
+ $color-complement-1: nth(complement-colors(), 2);
60
+ // ... etc.
61
+
62
+ .call-to-action {
63
+ background-color: $color-complement-0;
64
+ }
65
+
66
+ ```
67
+
68
+ **Note:** The `complement-colors` function only returns an array of colors when the `$complement` variable is set to `true` or the `$scheme` variable is set to `triad`. Otherwise an array with 5 `null`'s is returned.
69
+
70
+ #### secondary-1-colors and secondary-2-colors
71
+
72
+ Some color schemes contain 2 additional colors. These functions each returns an array of 5 colors with, again, 5 different shades of a color. You need the Sass' `nth` function to access a specific color:
73
+
74
+ ```
75
+ $color-secondary-1-0: nth(secondary-1-colors(), 1);
76
+ $color-secondary-1-1: nth(secondary-1-colors(), 2);
77
+ // ... etc.
78
+
79
+ $color-secondary-2-0: nth(secondary-2-colors(), 1);
80
+ $color-secondary-2-1: nth(secondary-2-colors(), 2);
81
+ // ... etc.
82
+
83
+ ```
84
+ **Note:** The `secondary-1-colors` and `secondary-2-colors` functions only returns an array of colors when the `$scheme` variable is set to `adjacent`, `tetrad` or `triad`. Otherwise an array with 5 `null`'s is returned.
85
+
86
+ ### Variables
87
+
88
+ You can (and might want to) define several variables to customize the color scheme.
89
+
90
+ #### $base-color
91
+
92
+ The color used as a base color to calculate the shades and all other colors. This can be any Sass color.
93
+
94
+ Defaults to `#ff0000` (red).
95
+
96
+ ```
97
+ $base-color: red;
98
+ $base-color: hsl(0deg, 100%, 50%);
99
+ $base-color: #ff0000;
100
+ // ... etc.
101
+ ```
102
+
103
+ #### $scheme
104
+
105
+ Sass-color-schemes supports 4 different color schemes:
106
+
107
+ * **monochromatic** - all the colors (tints, tones, and shades) of a single hue
108
+ * **adjacent** - groups of colors that are adjacent to each other on the color wheel
109
+ * **triad** - three colors equally spaced around the color wheel
110
+ * **tetrad** - four colors arranged into two complementary color pairs
111
+
112
+ Defaults to `'monochromatic'`.
113
+
114
+ ```
115
+ $scheme: 'monochromatic';
116
+ $scheme: 'tetrad';
117
+ // ... etc.
118
+
119
+ ```
120
+
121
+ #### $complement
122
+
123
+ If set to `true`, the `complement-colors` function returns shades of the complementary color of the `$base-color`.
124
+
125
+ Defaults to `false`.
126
+
127
+ ```
128
+ $complement: true;
129
+ $complement: false;
130
+
131
+ ```
132
+
133
+ #### $angle
134
+
135
+ The angle applied to the `$base-color` to calculate other colors in all schemes, expect `monochromatic`. This can be any value and can be set in degrees (deg) or radian (rad) units as well.
136
+
137
+ Defaults to `30deg`.
138
+
139
+ ```
140
+ $angle: 30;
141
+ $angle: 30deg;
142
+ $angle: 0.5236rad;
143
+ ```
144
+
145
+ #### $variation
146
+
147
+ This will vary the tints, tones and shades of the colors returned by all functions. Currently Sass-color-schemes supports 24 variations:
148
+
149
+ * lightest pale pastel
150
+ * very light pale pastel
151
+ * lighter pale pastel
152
+ * pale pastel
153
+ * darker pale pastel
154
+ * dark pale pastel
155
+ * greyish darkest
156
+ * greyish medium light
157
+ * bright pastel
158
+ * very light pastel
159
+ * lighter pastel
160
+ * pastel
161
+ * darker pastel
162
+ * dark pastel
163
+ * greyish dark
164
+ * greyish lighter
165
+ * shiny
166
+ * full colors
167
+ * darker colors
168
+ * darker neon
169
+ * dark
170
+ * deep colors
171
+ * greyish medium dark
172
+ * greyish lightest
173
+
174
+ Defaults to `full colors`.
175
+
176
+ ```
177
+ $variation: 'darker pale pastel';
178
+ $variation: 'shiny';
179
+ // ... etc.
180
+
181
+ ```
182
+
183
+ #### $mode
184
+
185
+ You can choose between:
186
+
187
+ * [RGB](http://en.wikipedia.org/wiki/RGB_color_model) (a.k.a. the light model)
188
+ * [RYB](http://en.wikipedia.org/wiki/RYB_color_model)
189
+
190
+ These modes are internally used when calculating colors. RYB is primarily used in art and design education.
191
+
192
+ Defaults to `ryb`.
193
+
194
+ ```
195
+ $mode: 'rgb';
196
+ $mode: 'ryb';
197
+
198
+ ```
199
+
200
+ ### Full example
201
+
202
+ ```
203
+ $base-color: #6893A6;
204
+ $variation: 'shiny';
205
+ $scheme: 'adjacent';
206
+ $angle: 25;
207
+ $complement: true;
208
+
209
+ $color-primary-0: nth(primary-colors(), 1);
210
+ $color-primary-1: nth(primary-colors(), 2);
211
+ $color-primary-2: nth(primary-colors(), 3);
212
+ $color-primary-3: nth(primary-colors(), 4);
213
+ $color-primary-4: nth(primary-colors(), 5);
214
+
215
+ $color-complement-0: nth(complement-colors(), 1);
216
+ $color-complement-1: nth(complement-colors(), 2);
217
+ $color-complement-2: nth(complement-colors(), 3);
218
+ $color-complement-3: nth(complement-colors(), 4);
219
+ $color-complement-4: nth(complement-colors(), 5);
220
+
221
+ $color-secondary-1-0: nth(secondary-1-colors(), 1);
222
+ $color-secondary-1-1: nth(secondary-1-colors(), 2);
223
+ $color-secondary-1-2: nth(secondary-1-colors(), 3);
224
+ $color-secondary-1-3: nth(secondary-1-colors(), 4);
225
+ $color-secondary-1-4: nth(secondary-1-colors(), 5);
226
+
227
+ $color-secondary-2-0: nth(secondary-2-colors(), 1);
228
+ $color-secondary-2-1: nth(secondary-2-colors(), 2);
229
+ $color-secondary-2-2: nth(secondary-2-colors(), 3);
230
+ $color-secondary-2-3: nth(secondary-2-colors(), 4);
231
+ $color-secondary-2-4: nth(secondary-2-colors(), 5);
232
+
233
+
234
+ ```
235
+
236
+ ## Contributing
237
+
238
+ 1. Fork it (https://github.com/bazzel/sass-color-schemes/fork)
239
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
240
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
241
+ 4. Push to the branch (`git push origin my-new-feature`)
242
+ 5. Create a new Pull Request
@@ -0,0 +1,5 @@
1
+ require 'compass'
2
+ require 'color-schemer'
3
+
4
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))
5
+ Compass::Frameworks.register('sass-color-schemes', path: extension_path)
@@ -0,0 +1,66 @@
1
+ @function primary-colors() {
2
+ @return _compose-shades($base-color);
3
+ }
4
+
5
+ @function complement-colors() {
6
+ @if ($complement == false) and ($scheme != 'tetrad') {
7
+ @return _empty-array();
8
+ }
9
+
10
+ @return _compose-color(180);
11
+ }
12
+
13
+ @function secondary-1-colors() {
14
+ @if ($scheme == 'triad') {
15
+ @return _compose-color(180 - $angle);
16
+ } @else if ($scheme == 'adjacent') or ($scheme == 'tetrad') {
17
+ @return _compose-color($angle);
18
+ } @else {
19
+ @return _empty-array();
20
+ }
21
+ }
22
+
23
+ @function secondary-2-colors() {
24
+ @if ($scheme == 'triad') or ($scheme == 'tetrad') {
25
+ @return _compose-color(180 + $angle);
26
+ } @else if ($scheme == 'adjacent') {
27
+ @return _compose-color(-$angle);
28
+ } @else {
29
+ @return _empty-array();
30
+ }
31
+ }
32
+
33
+ @function _compose-color($angle) {
34
+ $color: _adjust-hue($angle);
35
+ @return _compose-shades($color);
36
+ }
37
+
38
+ @function _adjust-hue($angle) {
39
+ @return if($mode == 'ryb', ryb-adjust-hue($base-color, $angle), adjust-hue($base-color, $angle));
40
+ }
41
+
42
+ @function _compose-shades($color) {
43
+ $shades: map-get($variations, $variation);
44
+
45
+ $colors: ();
46
+ @for $i from 1 through 5 {
47
+ $colors: append($colors, _adjust-color($color, $shades, $i));
48
+ }
49
+ @return $colors;
50
+ }
51
+
52
+ @function _adjust-color($base-color, $shades, $n) {
53
+ $sval: percentage(nth(nth($shades, $n), 1))/100;
54
+ $lval: percentage(nth(nth($shades, $n), 2))/100;
55
+ $color: scale-color($base-color, $saturation: $sval, $lightness: $lval);
56
+
57
+ @return $color;
58
+ }
59
+
60
+ @function _empty-array() {
61
+ $arr: ();
62
+ @for $i from 1 through 5 {
63
+ $arr: append($arr, null);
64
+ }
65
+ @return $arr;
66
+ }
@@ -0,0 +1,4 @@
1
+ @import 'color-schemer';
2
+
3
+ @import 'variables';
4
+ @import 'mixins';
@@ -0,0 +1,33 @@
1
+ $base-color: #ff0000 !default;
2
+ $variation: 'full colors' !default;
3
+ $scheme: 'monochromatic' !default; // monochromatic, adjacent, triad, tetrad
4
+ $mode: 'ryb' !default; // rgb, ryb
5
+ $angle: 30deg !default;
6
+ $complement: false !default;
7
+
8
+ $variations: (
9
+ 'lightest pale pastel': (0 77) (0 90) (0 82) (0 68) (0 60),
10
+ 'very light pale pastel': (0 65) (0 86) (0 77) (-26 42) (-44 15),
11
+ 'lighter pale pastel': (-36 48) (0 83) (0 75) (-49 22) (-52 -5),
12
+ 'pale pastel': (-71 9) (-17 83) (-63 42) (-70 -17) (-53 -40),
13
+ 'darker pale pastel': (-77 -35) (-81 15) (-81 -8) (-61 -48) (-44 -57),
14
+ 'dark pale pastel': (-85 -62) (-87 -8) (-87 -35) (-73 -68) (-62 -75),
15
+ 'greyish darkest': (-93 -72) (-79 -16) (-86 -40) (-80 -58) (-65 -50),
16
+ 'greyish medium light': (-95 17) (-78 35) (-94 2) (-92 -10) (-89 -23),
17
+ 'bright pastel': (0 34) (0 96) (0 60) (0 10) (0 0),
18
+ 'very light pastel': (0 42) (0 72) (0 57) (0 29) (-18 5),
19
+ 'lighter pastel': (-39 9) (0 63) (-13 42) (-35 -14) (-17 -38),
20
+ 'pastel': (-50 -9) (0 65) (-45 24) (-28 -42) (0 -66),
21
+ 'darker pastel': (-57 -41) (-77 -4) (-73 -29) (-43 -55) (-21 -70),
22
+ 'dark pastel': (-64 -65) (-69 -24) (-67 -44) (-50 -56) (-36 -55),
23
+ 'greyish dark': (-95 -55) (-93 -26) (-94 -42) (-92 -58) (-82 -68),
24
+ 'greyish lighter': (-87 60) (-25 82) (-85 45) (-85 25) (-84 12),
25
+ 'shiny': (0 0) (0 63) (0 43) (0 -14) (0 -35),
26
+ 'full colors': (0 0) (0 38) (0 22) (0 -22) (0 -40),
27
+ 'darker colors': (-12 -28) (-27 18) (-23 -6) (0 -43) (0 -59),
28
+ 'darker neon': (-10 -38) (-2 -8) (-11 -22) (0 -59) (0 -77),
29
+ 'dark': (0 -60) (-6 -75) (0 -70) (0 -40) (0 -19),
30
+ 'deep colors': (0 -78) (0 -83) (-8 -72) (0 -55) (0 -35),
31
+ 'greyish medium dark': (-96 -29) (-90 -8) (-95 -40) (-94 -52) (-92 -66),
32
+ 'greyish lightest': (0 96) (0 77) (0 85) (0 92) (-67 74)
33
+ );
@@ -0,0 +1,2 @@
1
+ # Make sure you list all the project template files here in the manifest.
2
+ stylesheet 'screen.scss', media: 'screen, projection'
@@ -0,0 +1,3 @@
1
+ // This is where you put the contents of the main stylesheet for the user's project.
2
+ // It should import your sass stylesheets and demonstrate how to use them.
3
+ @import 'sass-color-schemes';
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sass-color-schemes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Patrick Baselier
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: compass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: color-schemer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.8
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.8
41
+ description: Makes it easy to use color schemes in your web pages by providing a collection
42
+ of colors based on one (base-) color which is supplemented with additional colors
43
+ to make the best visual impression.
44
+ email:
45
+ - patrick.baselier@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - README.md
51
+ - lib/sass-color-schemes.rb
52
+ - stylesheets/_mixins.scss
53
+ - stylesheets/_sass-color-schemes.scss
54
+ - stylesheets/_variables.scss
55
+ - templates/project/manifest.rb
56
+ - templates/project/screen.scss
57
+ homepage: https://github.com/bazzel/sass-color-schemes
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.2.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Use color schemes in your web pages the easy way
81
+ test_files: []