color-schemer 0.1.2 → 0.1.3
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.
- data/color-schemer.gemspec +1 -1
- data/lib/color-schemer.rb +2 -2
- data/stylesheets/_color-schemer.sass +56 -58
- metadata +10 -3
data/color-schemer.gemspec
CHANGED
data/lib/color-schemer.rb
CHANGED
@@ -13,89 +13,93 @@ $base-color: #f00 !default
|
|
13
13
|
$color-scheme: mono !default
|
14
14
|
$hue-offset: 20 !default
|
15
15
|
$brightness-offset: 10% !default
|
16
|
-
$color-
|
16
|
+
$color-model: rgb !default
|
17
17
|
$equalize: false !default
|
18
18
|
|
19
19
|
// Normalizer credit to Mason Wendell: https://github.com/canarymason/The-Coding-Designers-Survival-Kit/blob/master/sass/partials/lib/variables/_color_schemes.sass
|
20
20
|
@function equalize($color)
|
21
21
|
@return hsl(hue($color), 100%, 50%)
|
22
22
|
|
23
|
-
//
|
24
|
-
@function
|
23
|
+
// RYB color model complement
|
24
|
+
@function ryb-complement($color)
|
25
25
|
$hue: round(hue($color)/ 10) // find and round hue
|
26
|
+
$newhue: $hue
|
27
|
+
$sat: saturation($color)
|
28
|
+
$lite: lightness($color)
|
26
29
|
// Manually adjusted values until these can be mathmatically explained.
|
27
30
|
@if $hue == 0
|
28
|
-
|
31
|
+
$newhue: hue(adjust-hue(invert($color), -60)) // Start with red
|
29
32
|
@if $hue == 1
|
30
|
-
|
33
|
+
$newhue: hue(adjust-hue(invert($color), -50))
|
31
34
|
@if $hue == 2
|
32
|
-
|
35
|
+
$newhue: hue(adjust-hue(invert($color), -40))
|
33
36
|
@if $hue == 3
|
34
|
-
|
37
|
+
$newhue: hue(adjust-hue(invert($color), -25))
|
35
38
|
@if $hue == 4
|
36
|
-
|
39
|
+
$newhue: hue(adjust-hue(invert($color), 0))
|
37
40
|
@if $hue == 5
|
38
|
-
|
41
|
+
$newhue: hue(adjust-hue(invert($color), 25))
|
39
42
|
@if $hue == 6
|
40
|
-
|
43
|
+
$newhue: hue(adjust-hue(invert($color), 38))
|
41
44
|
@if $hue == 7
|
42
|
-
|
45
|
+
$newhue: hue(adjust-hue(invert($color), 44))
|
43
46
|
@if $hue == 8
|
44
|
-
|
47
|
+
$newhue: hue(adjust-hue(invert($color), 52))
|
45
48
|
@if $hue == 9
|
46
|
-
|
49
|
+
$newhue: hue(adjust-hue(invert($color), 58))
|
47
50
|
@if $hue == 10
|
48
|
-
|
51
|
+
$newhue: hue(adjust-hue(invert($color), 59))
|
49
52
|
@if $hue == 11
|
50
|
-
|
53
|
+
$newhue: hue(adjust-hue(invert($color), 60))
|
51
54
|
@if $hue == 12
|
52
|
-
|
55
|
+
$newhue: hue(adjust-hue(invert($color), 60)) // Green is halfway through the RYB model.
|
53
56
|
@if $hue == 13
|
54
|
-
|
57
|
+
$newhue: hue(adjust-hue(invert($color), 55))
|
55
58
|
@if $hue == 14
|
56
|
-
|
59
|
+
$newhue: hue(adjust-hue(invert($color), 50))
|
57
60
|
@if $hue == 15
|
58
|
-
|
61
|
+
$newhue: hue(adjust-hue(invert($color), 45))
|
59
62
|
@if $hue == 16
|
60
|
-
|
63
|
+
$newhue: hue(adjust-hue(invert($color), 40))
|
61
64
|
@if $hue == 17
|
62
|
-
|
65
|
+
$newhue: hue(adjust-hue(invert($color), 35))
|
63
66
|
@if $hue == 18
|
64
|
-
|
67
|
+
$newhue: hue(adjust-hue(invert($color), 30))
|
65
68
|
@if $hue == 19
|
66
|
-
|
69
|
+
$newhue: hue(adjust-hue(invert($color), 25))
|
67
70
|
@if $hue == 20
|
68
|
-
|
71
|
+
$newhue: hue(adjust-hue(invert($color), 20))
|
69
72
|
@if $hue == 21
|
70
|
-
|
73
|
+
$newhue: hue(adjust-hue(invert($color), 15))
|
71
74
|
@if $hue == 22
|
72
|
-
|
75
|
+
$newhue: hue(adjust-hue(invert($color), -5))
|
73
76
|
@if $hue == 23
|
74
|
-
|
77
|
+
$newhue: hue(adjust-hue(invert($color), -8))
|
75
78
|
@if $hue == 24
|
76
|
-
|
79
|
+
$newhue: hue(adjust-hue(invert($color), -17))
|
77
80
|
@if $hue == 25
|
78
|
-
|
81
|
+
$newhue: hue(adjust-hue(invert($color), -25))
|
79
82
|
@if $hue == 26
|
80
|
-
|
83
|
+
$newhue: hue(adjust-hue(invert($color), -30))
|
81
84
|
@if $hue == 27
|
82
|
-
|
85
|
+
$newhue: hue(adjust-hue(invert($color), -35))
|
83
86
|
@if $hue == 28
|
84
|
-
|
87
|
+
$newhue: hue(adjust-hue(invert($color), -40))
|
85
88
|
@if $hue == 29
|
86
|
-
|
89
|
+
$newhue: hue(adjust-hue(invert($color), -43))
|
87
90
|
@if $hue == 30
|
88
|
-
|
91
|
+
$newhue: hue(adjust-hue(invert($color), -46))
|
89
92
|
@if $hue == 31
|
90
|
-
|
93
|
+
$newhue: hue(adjust-hue(invert($color), -49))
|
91
94
|
@if $hue == 32
|
92
|
-
|
95
|
+
$newhue: hue(adjust-hue(invert($color), -52))
|
93
96
|
@if $hue == 33
|
94
|
-
|
97
|
+
$newhue: hue(adjust-hue(invert($color), -54))
|
95
98
|
@if $hue == 34
|
96
|
-
|
99
|
+
$newhue: hue(adjust-hue(invert($color), -57))
|
97
100
|
@if $hue == 35
|
98
|
-
|
101
|
+
$newhue: hue(adjust-hue(invert($color), -60))
|
102
|
+
@return hsl($newhue,$sat,$lite)
|
99
103
|
|
100
104
|
// Add percentage of white to a color
|
101
105
|
@function tint($color, $percent)
|
@@ -105,7 +109,7 @@ $equalize: false !default
|
|
105
109
|
@function shade($color, $percent)
|
106
110
|
@return mix(black, $color, $percent)
|
107
111
|
|
108
|
-
@function color-schemer($color-location
|
112
|
+
@function color-schemer($color-location:$color-location,$base-color:$base-color,$color-scheme:$color-scheme,$hue-offset:$hue-offset)
|
109
113
|
// Primary, just return the base-color.
|
110
114
|
@if $equalize
|
111
115
|
$base-color: equalize($base-color)
|
@@ -116,12 +120,12 @@ $equalize: false !default
|
|
116
120
|
@if $color-scheme == mono
|
117
121
|
@return lighten($base-color, $brightness-offset)
|
118
122
|
@if $color-scheme == complement
|
119
|
-
@if $color-
|
120
|
-
@return
|
123
|
+
@if $color-model == ryb
|
124
|
+
@return ryb-complement($base-color)
|
121
125
|
@return complement($base-color)
|
122
126
|
@if $color-scheme == triad
|
123
|
-
@if $color-
|
124
|
-
@return adjust-hue(
|
127
|
+
@if $color-model == ryb
|
128
|
+
@return adjust-hue(ryb-complement($base-color), $hue-offset)
|
125
129
|
@return adjust-hue(complement($base-color), $hue-offset)
|
126
130
|
@if $color-scheme == tetrad
|
127
131
|
@return adjust-hue($base-color, $hue-offset)
|
@@ -137,12 +141,12 @@ $equalize: false !default
|
|
137
141
|
@if $color-scheme == complement
|
138
142
|
@return lighten($base-color, $brightness-offset)
|
139
143
|
@if $color-scheme == triad
|
140
|
-
@if $color-
|
141
|
-
@return adjust-hue(
|
144
|
+
@if $color-model == ryb
|
145
|
+
@return adjust-hue(ryb-complement($base-color), -$hue-offset)
|
142
146
|
@return adjust-hue(complement($base-color), -$hue-offset)
|
143
147
|
@if $color-scheme == tetrad
|
144
|
-
@if $color-
|
145
|
-
@return
|
148
|
+
@if $color-model == ryb
|
149
|
+
@return ryb-complement($base-color)
|
146
150
|
@return complement($base-color)
|
147
151
|
@if $color-scheme == analogic
|
148
152
|
@return adjust-hue($base-color, -$hue-offset)
|
@@ -158,23 +162,17 @@ $equalize: false !default
|
|
158
162
|
@if $color-scheme == triad
|
159
163
|
@return darken($base-color, $brightness-offset)
|
160
164
|
@if $color-scheme == tetrad
|
161
|
-
@if $color-
|
162
|
-
@return adjust-hue(
|
165
|
+
@if $color-model == ryb
|
166
|
+
@return adjust-hue(ryb-complement($base-color), $hue-offset)
|
163
167
|
@return adjust-hue(complement($base-color), $hue-offset)
|
164
168
|
@if $color-scheme == analogic
|
165
169
|
@return darken($base-color, $brightness-offset)
|
166
170
|
@if $color-scheme == accented-analogic
|
167
|
-
@if $color-
|
168
|
-
@return
|
171
|
+
@if $color-model == ryb
|
172
|
+
@return ryb-complement($base-color)
|
169
173
|
@return complement($base-color)
|
170
174
|
@warn "Oops! You didn’t properly define $color-scheme (complement, triad...)"
|
171
175
|
@warn "Oops! You didn’t properly define $color-location (primary, secondary...)"
|
172
176
|
|
173
|
-
// Write your basic color scheme
|
174
|
-
$primary: color-schemer(primary) !default
|
175
|
-
$secondary: color-schemer(secondary) !default
|
176
|
-
$tertiary: color-schemer(tertiary) !default
|
177
|
-
$quadrary: color-schemer(quadrary) !default
|
178
|
-
|
179
177
|
// Tell other files that this is loaded.
|
180
178
|
$color-schemer-loaded: true
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: color-schemer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Scott Kellum
|
@@ -22,9 +23,11 @@ dependencies:
|
|
22
23
|
name: compass
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ~>
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 29
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
- 11
|
@@ -54,16 +57,20 @@ rdoc_options: []
|
|
54
57
|
require_paths:
|
55
58
|
- lib
|
56
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
57
61
|
requirements:
|
58
62
|
- - ">="
|
59
63
|
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
60
65
|
segments:
|
61
66
|
- 0
|
62
67
|
version: "0"
|
63
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
64
70
|
requirements:
|
65
71
|
- - ">="
|
66
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 17
|
67
74
|
segments:
|
68
75
|
- 1
|
69
76
|
- 3
|
@@ -72,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
79
|
requirements: []
|
73
80
|
|
74
81
|
rubyforge_project: color-schemer
|
75
|
-
rubygems_version: 1.3.
|
82
|
+
rubygems_version: 1.3.7
|
76
83
|
signing_key:
|
77
84
|
specification_version: 3
|
78
85
|
summary: Create color schemes with ease.
|