color-schemer 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{color-schemer}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5")
8
8
  s.authors = ["Scott Kellum", "Mason Wendell"]
@@ -1,9 +1,9 @@
1
1
  require 'compass'
2
2
  Compass::Frameworks.register("color-schemer", :path => "#{File.dirname(__FILE__)}/..")
3
3
 
4
- module ModularScale
4
+ module ColorSchemer
5
5
 
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.3"
7
7
  DATE = "2011-09-15"
8
8
 
9
9
  end
@@ -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-theory: rgb !default
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
- // Complement based on Claude Boutet's color wheel
24
- @function boutet-complement($color)
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
- @return adjust-hue(invert($color), -60) // Start with red
31
+ $newhue: hue(adjust-hue(invert($color), -60)) // Start with red
29
32
  @if $hue == 1
30
- @return adjust-hue(invert($color), -50)
33
+ $newhue: hue(adjust-hue(invert($color), -50))
31
34
  @if $hue == 2
32
- @return adjust-hue(invert($color), -40)
35
+ $newhue: hue(adjust-hue(invert($color), -40))
33
36
  @if $hue == 3
34
- @return adjust-hue(invert($color), -25)
37
+ $newhue: hue(adjust-hue(invert($color), -25))
35
38
  @if $hue == 4
36
- @return adjust-hue(invert($color), 0)
39
+ $newhue: hue(adjust-hue(invert($color), 0))
37
40
  @if $hue == 5
38
- @return adjust-hue(invert($color), 25)
41
+ $newhue: hue(adjust-hue(invert($color), 25))
39
42
  @if $hue == 6
40
- @return adjust-hue(invert($color), 38)
43
+ $newhue: hue(adjust-hue(invert($color), 38))
41
44
  @if $hue == 7
42
- @return adjust-hue(invert($color), 44)
45
+ $newhue: hue(adjust-hue(invert($color), 44))
43
46
  @if $hue == 8
44
- @return adjust-hue(invert($color), 52)
47
+ $newhue: hue(adjust-hue(invert($color), 52))
45
48
  @if $hue == 9
46
- @return adjust-hue(invert($color), 58)
49
+ $newhue: hue(adjust-hue(invert($color), 58))
47
50
  @if $hue == 10
48
- @return adjust-hue(invert($color), 59)
51
+ $newhue: hue(adjust-hue(invert($color), 59))
49
52
  @if $hue == 11
50
- @return adjust-hue(invert($color), 60)
53
+ $newhue: hue(adjust-hue(invert($color), 60))
51
54
  @if $hue == 12
52
- @return adjust-hue(invert($color), 60) // Green is halfway through the Boutet scale.
55
+ $newhue: hue(adjust-hue(invert($color), 60)) // Green is halfway through the RYB model.
53
56
  @if $hue == 13
54
- @return adjust-hue(invert($color), 55)
57
+ $newhue: hue(adjust-hue(invert($color), 55))
55
58
  @if $hue == 14
56
- @return adjust-hue(invert($color), 50)
59
+ $newhue: hue(adjust-hue(invert($color), 50))
57
60
  @if $hue == 15
58
- @return adjust-hue(invert($color), 45)
61
+ $newhue: hue(adjust-hue(invert($color), 45))
59
62
  @if $hue == 16
60
- @return adjust-hue(invert($color), 40)
63
+ $newhue: hue(adjust-hue(invert($color), 40))
61
64
  @if $hue == 17
62
- @return adjust-hue(invert($color), 35)
65
+ $newhue: hue(adjust-hue(invert($color), 35))
63
66
  @if $hue == 18
64
- @return adjust-hue(invert($color), 30)
67
+ $newhue: hue(adjust-hue(invert($color), 30))
65
68
  @if $hue == 19
66
- @return adjust-hue(invert($color), 25)
69
+ $newhue: hue(adjust-hue(invert($color), 25))
67
70
  @if $hue == 20
68
- @return adjust-hue(invert($color), 20)
71
+ $newhue: hue(adjust-hue(invert($color), 20))
69
72
  @if $hue == 21
70
- @return adjust-hue(invert($color), 15)
73
+ $newhue: hue(adjust-hue(invert($color), 15))
71
74
  @if $hue == 22
72
- @return adjust-hue(invert($color), -5)
75
+ $newhue: hue(adjust-hue(invert($color), -5))
73
76
  @if $hue == 23
74
- @return adjust-hue(invert($color), -8)
77
+ $newhue: hue(adjust-hue(invert($color), -8))
75
78
  @if $hue == 24
76
- @return adjust-hue(invert($color), -17)
79
+ $newhue: hue(adjust-hue(invert($color), -17))
77
80
  @if $hue == 25
78
- @return adjust-hue(invert($color), -25)
81
+ $newhue: hue(adjust-hue(invert($color), -25))
79
82
  @if $hue == 26
80
- @return adjust-hue(invert($color), -30)
83
+ $newhue: hue(adjust-hue(invert($color), -30))
81
84
  @if $hue == 27
82
- @return adjust-hue(invert($color), -35)
85
+ $newhue: hue(adjust-hue(invert($color), -35))
83
86
  @if $hue == 28
84
- @return adjust-hue(invert($color), -40)
87
+ $newhue: hue(adjust-hue(invert($color), -40))
85
88
  @if $hue == 29
86
- @return adjust-hue(invert($color), -43)
89
+ $newhue: hue(adjust-hue(invert($color), -43))
87
90
  @if $hue == 30
88
- @return adjust-hue(invert($color), -46)
91
+ $newhue: hue(adjust-hue(invert($color), -46))
89
92
  @if $hue == 31
90
- @return adjust-hue(invert($color), -49)
93
+ $newhue: hue(adjust-hue(invert($color), -49))
91
94
  @if $hue == 32
92
- @return adjust-hue(invert($color), -52)
95
+ $newhue: hue(adjust-hue(invert($color), -52))
93
96
  @if $hue == 33
94
- @return adjust-hue(invert($color), -54)
97
+ $newhue: hue(adjust-hue(invert($color), -54))
95
98
  @if $hue == 34
96
- @return adjust-hue(invert($color), -57)
99
+ $newhue: hue(adjust-hue(invert($color), -57))
97
100
  @if $hue == 35
98
- @return adjust-hue(invert($color), -60)
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, $base-color, $color-scheme, $hue-offset)
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-theory == boutet
120
- @return boutet-complement($base-color)
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-theory == boutet
124
- @return adjust-hue(boutet-complement($base-color), $hue-offset)
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-theory == boutet
141
- @return adjust-hue(boutet-complement($base-color), -$hue-offset)
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-theory == boutet
145
- @return boutet-complement($base-color)
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-theory == boutet
162
- @return adjust-hue(boutet-complement($base-color), $hue-offset)
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-theory == boutet
168
- @return boutet-complement($base-color)
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
- - 2
9
- version: 0.1.2
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.6
82
+ rubygems_version: 1.3.7
76
83
  signing_key:
77
84
  specification_version: 3
78
85
  summary: Create color schemes with ease.