particle 1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ Particle
2
+ --------
3
+
4
+ This is my Sass playground, enjoy! It's a compass plugin and has an assortment of handy tools and libraries.
5
+
6
+ ##Installation
7
+
8
+ From the command line:
9
+
10
+ ```
11
+ gem install particle
12
+ ```
13
+
14
+ Add to your project:
15
+
16
+ Rails: compass.config, config.rb
17
+
18
+ ```
19
+ require 'particle'
20
+ ```
21
+
22
+ Command line:
23
+
24
+ ```
25
+ compass install particle
26
+ ```
27
+
28
+ Or create a new project:
29
+
30
+ ```
31
+ compass -r particle -f particle project_directory
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```
37
+ @include particle;
38
+ ```
39
+
40
+ ## Contact
41
+
42
+ Stephen Way
43
+
44
+ - http://github.com/stephenway
45
+ - http://twitter.com/stephencway
46
+ - http://alpha.app.net/stephenway
47
+ - stephencway@me.com
48
+
49
+ ## License
50
+
51
+ Copyright (c) 2010-2012 Stephen Way
52
+ All Rights Reserved.
53
+ Released under a [slightly modified MIT License][license].
data/lib/particle.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'compass'
2
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
+ Compass::Frameworks.register('particle', :path => extension_path)
@@ -0,0 +1,2 @@
1
+ @import "particle/css3";
2
+ @import "particle/typography";
@@ -0,0 +1,5 @@
1
+ @import "particle/css3/blend-modes";
2
+ @import "particle/css3/drop-shadow";
3
+ @import "particle/css3/gradient";
4
+ @import "particle/css3/noise";
5
+ @import "particle/css3/rotate";
@@ -0,0 +1,5 @@
1
+ @import "particle/layout/apprise";
2
+ @import "particle/layout/images";
3
+ @import "particle/layout/jquery-ui";
4
+ @import "particle/layout/slider";
5
+ @import "particle/layout/ui";
@@ -0,0 +1,3 @@
1
+ @import "particle/typography/render-fix";
2
+ @import "particle/typography/legible-color-text";
3
+ @import "particle/typography/text-replacement";
@@ -0,0 +1,367 @@
1
+ // Source: https://github.com/heygrady/scss-blend-modes
2
+
3
+ //--------------------------------
4
+ // Normal
5
+ //--------------------------------
6
+ @function blend-normal ($blend, $base) {
7
+ $opacity: opacity($blend);
8
+ $base-opacity: opacity($base);
9
+
10
+ // calculate opacity
11
+ $red: red($blend) * $opacity + red($base) * $base-opacity * (1 - $opacity);
12
+ $green: green($blend) * $opacity + green($base) * $base-opacity * (1 - $opacity);
13
+ $blue: blue($blend) * $opacity + blue($base) * $base-opacity * (1 - $opacity);
14
+ @return rgb($red, $green, $blue);
15
+ }
16
+
17
+ //--------------------------------
18
+ // Multiply
19
+ //--------------------------------
20
+ @function blend-multiply ($blend, $base) {
21
+ $red: red($base) * red($blend) / 255;
22
+ $green: green($base) * green($blend) / 255;
23
+ $blue: blue($base) * blue($blend) / 255;
24
+
25
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
26
+ }
27
+
28
+ //--------------------------------
29
+ // Lighten
30
+ //--------------------------------
31
+ @function blend-lighten ($blend, $base) {
32
+ $red: blend-lighten-color(red($blend), red($base));
33
+ $green: blend-lighten-color(green($blend), green($base));
34
+ $blue: blend-lighten-color(blue($blend), blue($base));
35
+
36
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
37
+ }
38
+ @function blend-lighten-color($blend, $base) {
39
+ @if $base > $blend {
40
+ $blend: $base;
41
+ }
42
+ @return $blend;
43
+ }
44
+
45
+ //--------------------------------
46
+ // Darken
47
+ //--------------------------------
48
+ @function blend-darken ($blend, $base) {
49
+ $red: blend-darken-color(red($blend), red($base));
50
+ $green: blend-darken-color(green($blend), green($base));
51
+ $blue: blend-darken-color(blue($blend), blue($base));
52
+
53
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
54
+ }
55
+ @function blend-darken-color($blend, $base) {
56
+ @if $base < $blend {
57
+ $blend: $base;
58
+ }
59
+ @return $blend;
60
+ }
61
+
62
+ //--------------------------------
63
+ // Darker Color
64
+ //--------------------------------
65
+ @function blend-darkercolor ($blend, $base) {
66
+ $red: red($blend);
67
+ $green: green($blend);
68
+ $blue: blue($blend);
69
+ $base-red: red($base);
70
+ $base-green: green($base);
71
+ $base-blue: blue($base);
72
+
73
+ @if $base-red * 0.3 + $base-green * 0.59 + $base-blue * 0.11 <= $red * 0.3 + $green * 0.59 + $blue * 0.11 {
74
+ $red: $base-red;
75
+ $green: $base-green;
76
+ $blue: $base-blue;
77
+ }
78
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
79
+ }
80
+
81
+ //--------------------------------
82
+ // Lighter Color
83
+ //--------------------------------
84
+ @function blend-lightercolor ($blend, $base) {
85
+ $red: red($blend);
86
+ $green: green($blend);
87
+ $blue: blue($blend);
88
+ $base-red: red($base);
89
+ $base-green: green($base);
90
+ $base-blue: blue($base);
91
+
92
+ @if $base-red * 0.3 + $base-green * 0.59 + $base-blue * 0.11 > $red * 0.3 + $green * 0.59 + $blue * 0.11 {
93
+ $red: $base-red;
94
+ $green: $base-green;
95
+ $blue: $base-blue;
96
+ }
97
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
98
+ }
99
+
100
+ //--------------------------------
101
+ // Linear Dodge
102
+ //--------------------------------
103
+ @function blend-lineardodge ($blend, $base) {
104
+ $red: blend-lineardodge-color(red($blend), red($base));
105
+ $green: blend-lineardodge-color(green($blend), green($base));
106
+ $blue: blend-lineardodge-color(blue($blend), blue($base));
107
+
108
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
109
+ }
110
+ @function blend-lineardodge-color($blend, $base) {
111
+ @if $base + $blend > 255 {
112
+ $blend: 255;
113
+ }
114
+ @else {
115
+ $blend: $base + $blend;
116
+ }
117
+ @return $blend;
118
+ }
119
+
120
+ //--------------------------------
121
+ // Linear Burn
122
+ //--------------------------------
123
+ @function blend-linearburn ($blend, $base) {
124
+ $red: blend-linearburn-color(red($blend), red($base));
125
+ $green: blend-linearburn-color(green($blend), green($base));
126
+ $blue: blend-linearburn-color(blue($blend), blue($base));
127
+
128
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
129
+ }
130
+ @function blend-linearburn-color($blend, $base) {
131
+ @if $base + $blend < 255 {
132
+ $blend: 0;
133
+ }
134
+ @else {
135
+ $blend: $base + $blend - 255;
136
+ }
137
+ @return $blend;
138
+ }
139
+
140
+ //--------------------------------
141
+ // Difference
142
+ //--------------------------------
143
+ @function blend-difference ($blend, $base) {
144
+ $red: abs(red($base) - red($blend));
145
+ $green: abs(green($base) - green($blend));
146
+ $blue: abs(blue($base) - blue($blend));
147
+
148
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
149
+ }
150
+
151
+ //--------------------------------
152
+ // Screen
153
+ //--------------------------------
154
+ @function blend-screen ($blend, $base) {
155
+ $red: red($blend);
156
+ $green: green($blend);
157
+ $blue: blue($blend);
158
+ $base-red: red($base);
159
+ $base-green: green($base);
160
+ $base-blue: blue($base);
161
+
162
+
163
+ $red: (255 - ( ((255 - $red) * (255 - $base-red)) / 256));
164
+ $green: (255 - ( ((255 - $green) * (255 - $base-green)) / 256));
165
+ $blue: (255 - ( ((255 - $blue) * (255 - $base-blue)) / 256));
166
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
167
+ }
168
+
169
+ //--------------------------------
170
+ // Exclusion
171
+ //--------------------------------
172
+ @function blend-exclusion ($blend, $base) {
173
+ $red: red($blend);
174
+ $green: green($blend);
175
+ $blue: blue($blend);
176
+ $base-red: red($base);
177
+ $base-green: green($base);
178
+ $base-blue: blue($base);
179
+
180
+
181
+ $red: $base-red - ($base-red * $blend-div - 1) * $red;
182
+ $green: $base-green - ($base-green * $blend-div - 1) * $green;
183
+ $blue: $base-blue - ($base-blue * $blend-div - 1) * $blue;
184
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
185
+ }
186
+
187
+ //--------------------------------
188
+ // Overlay
189
+ //--------------------------------
190
+ @function blend-overlay ($blend, $base) {
191
+ $red: blend-overlay-color(red($blend), red($base));
192
+ $green: blend-overlay-color(green($blend), green($base));
193
+ $blue: blend-overlay-color(blue($blend), blue($base));
194
+
195
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
196
+ }
197
+ @function blend-overlay-color($blend, $base) {
198
+ @if $base <= 255 / 2 {
199
+ $blend: (2 * $base * $blend) / 255;
200
+ } @else {
201
+ $blend: 255 - (255 - 2 * ($base - (255 / 2))) * (255 - $blend) / 255;
202
+ }
203
+ @return $blend;
204
+ }
205
+
206
+ //--------------------------------
207
+ // Soft Light
208
+ //--------------------------------
209
+ @function blend-softlight ($blend, $base) {
210
+ $red: blend-softlight-color(red($blend), red($base));
211
+ $green: blend-softlight-color(green($blend), green($base));
212
+ $blue: blend-softlight-color(blue($blend), blue($base));
213
+
214
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
215
+ }
216
+ @function blend-softlight-color($blend, $base) {
217
+ @if $base < 128 {
218
+ $blend: (($blend / 2) + 64) * $base * $blend-div;
219
+ } @else {
220
+ $blend: 255 - (191 - ($blend / 2)) * (255 - $base) * $blend-div;
221
+ }
222
+ @return $blend;
223
+ }
224
+
225
+ //--------------------------------
226
+ // Hard Light
227
+ //--------------------------------
228
+ @function blend-hardlight ($blend, $base) {
229
+ $red: blend-hardlight-color(red($blend), red($base));
230
+ $green: blend-hardlight-color(green($blend), green($base));
231
+ $blue: blend-hardlight-color(blue($blend), blue($base));
232
+
233
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
234
+ }
235
+ @function blend-hardlight-color($blend, $base) {
236
+ $tmp-blend: $blend;
237
+ @if $tmp-blend < 128 {
238
+ $blend: $base * $tmp-blend * $blend-div;
239
+ } @else {
240
+ $blend: 255 - (255-$base) * (255-$tmp-blend) * $blend-div;
241
+ }
242
+ @return $blend;
243
+ }
244
+
245
+ //--------------------------------
246
+ // Color Dodge
247
+ //--------------------------------
248
+ @function blend-colordodge ($blend, $base) {
249
+ $red: blend-colordodge-color(red($blend), red($base));
250
+ $green: blend-colordodge-color(green($blend), green($base));
251
+ $blue: blend-colordodge-color(blue($blend), blue($base));
252
+
253
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
254
+ }
255
+ @function blend-colordodge-color($blend, $base) {
256
+ $tmp: $base * 256 / (255 - $blend);
257
+ @if $tmp > 255 or $blend == 255 {
258
+ $blend: 255;
259
+ } @else {
260
+ $blend: $tmp;
261
+ }
262
+ @return $blend;
263
+ }
264
+
265
+ //--------------------------------
266
+ // Color Burn
267
+ //--------------------------------
268
+ @function blend-colorburn ($blend, $base) {
269
+ $red: blend-colorburn-color(red($blend), red($base));
270
+ $green: blend-colorburn-color(green($blend), green($base));
271
+ $blue: blend-colorburn-color(blue($blend), blue($base));
272
+
273
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
274
+ }
275
+ @function blend-colorburn-color($blend, $base) {
276
+ $tmp: (256 - ((255 - $base) * 256) / $blend);
277
+
278
+ // TODO: hacked to replicate photoshop
279
+ @if $blend == 0 {
280
+ $blend: 255;
281
+ } @elseif $tmp < 0 {
282
+ $blend: 0;
283
+ } @else {
284
+ $blend: $tmp;
285
+ }
286
+ @return $blend;
287
+ }
288
+
289
+ //--------------------------------
290
+ // Linear Light
291
+ //--------------------------------
292
+ @function blend-linearlight ($blend, $base) {
293
+ $red: blend-linearlight-color(red($blend), red($base));
294
+ $green: blend-linearlight-color(green($blend), green($base));
295
+ $blue: blend-linearlight-color(blue($blend), blue($base));
296
+
297
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
298
+ }
299
+ @function blend-linearlight-color($blend, $base) {
300
+ @if $blend < 128 {
301
+ $blend: blend-linearburn-color($base, 2 * $blend);
302
+ } @else {
303
+ $blend: blend-lineardodge-color($base, 2 * ($blend - 128));
304
+ }
305
+ @return $blend;
306
+ }
307
+
308
+ //--------------------------------
309
+ // Vivid Light
310
+ //--------------------------------
311
+ @function blend-vividlight ($blend, $base) {
312
+ $red: blend-vividlight-color(red($blend), red($base));
313
+ $green: blend-vividlight-color(green($blend), green($base));
314
+ $blue: blend-vividlight-color(blue($blend), blue($base));
315
+
316
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
317
+ }
318
+
319
+ @function blend-vividlight-color($blend, $base) {
320
+ @if $blend < 128 {
321
+ $blend: blend-colorburn-color(2 * $blend, $base);
322
+ } @else {
323
+ $blend: blend-colordodge-color(2 * ($blend - 128), $base);
324
+ }
325
+ @return $blend;
326
+ }
327
+
328
+ //--------------------------------
329
+ // Pin Light
330
+ //--------------------------------
331
+ @function blend-pinlight ($blend, $base) {
332
+ $red: blend-pinlight-color(red($blend), red($base));
333
+ $green: blend-pinlight-color(green($blend), green($base));
334
+ $blue: blend-pinlight-color(blue($blend), blue($base));
335
+
336
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
337
+ }
338
+
339
+ @function blend-pinlight-color($blend, $base) {
340
+ @if $blend < 128 {
341
+ $blend: blend-darken-color($base, 2 * $blend);
342
+ } @else {
343
+ $blend: blend-lighten-color($base, 2 * ($blend - 128));
344
+ }
345
+ @return $blend;
346
+ }
347
+
348
+ //--------------------------------
349
+ // Hard Mix
350
+ //--------------------------------
351
+ @function blend-hardmix ($blend, $base) {
352
+ $red: blend-hardmix-color(red($blend), red($base));
353
+ $green: blend-hardmix-color(green($blend), green($base));
354
+ $blue: blend-hardmix-color(blue($blend), blue($base));
355
+
356
+ @return blend-normal(rgba($red, $green, $blue, opacity($blend)), $base);
357
+ }
358
+
359
+ @function blend-hardmix-color($blend, $base) {
360
+ $tmp: blend-vividlight-color($blend, $base);
361
+ @if $tmp < 128 {
362
+ $blend: 0;
363
+ } @else {
364
+ $blend: 255;
365
+ }
366
+ @return $blend;
367
+ }
@@ -0,0 +1,18 @@
1
+ $default-drop-shadow-color: #aaa !default;
2
+ $default-drop-shadow-h-offset: 0px !default;
3
+ $default-drop-shadow-v-offset: 0px !default;
4
+ $default-drop-shadow-blur: 1px !default;
5
+
6
+ @mixin drop-shadow(
7
+ $color: $default-drop-shadow-color,
8
+ $offX: $default-drop-shadow-h-offset,
9
+ $offY: $default-drop-shadow-v-offset,
10
+ $blur: $default-drop-shadow-blur
11
+ ) {
12
+ @if $color == none {
13
+ text-shadow: none;
14
+ } @else {
15
+ text-shadow: $color $offX $offY $blur;
16
+ filter: dropshadow(color=#{$color}, offX=#{$offX}, offY=#{$offY});
17
+ }
18
+ }
@@ -0,0 +1,41 @@
1
+ @import "compass/css3/images";
2
+
3
+ // Gradient Mixins
4
+ @mixin gradient($start, $end, $direction: top) {
5
+ @include background(linear-gradient($direction, $start, $end));
6
+ @include filter-gradient($start, $end);
7
+ background-color: mix($start, $end);
8
+ } //@mixin…
9
+
10
+ // Credit Brandon Mathis
11
+ @mixin gradient-bg($color, $top: 5, $bottom: $top) {
12
+ @if $top < 0 and $bottom < 0 {
13
+ $color1: darken($color, abs($top));
14
+ $color2: lighten($color, abs($bottom));
15
+ @include background(linear-gradient(top, $color1, $color2));
16
+ @include filter-gradient($color1, $color2);
17
+ } //@if…
18
+ @else {
19
+ $color1: lighten($color, abs($top));
20
+ $color2: darken($color, abs($bottom));
21
+ @include background(linear-gradient(top, $color1, $color2));
22
+ @include filter-gradient($color1, $color2);
23
+ } //@else…
24
+ background-color: $color !important;
25
+ } //@mixin…
26
+
27
+ @mixin gradient-inverse-bg($color, $top: 5, $bottom: $top) {
28
+ @if $top < 0 and $bottom < 0 {
29
+ $color1: darken($color, abs($top));
30
+ $color2: lighten($color, abs($bottom));
31
+ @include background(linear-gradient(top, $color2, $color1));
32
+ @include filter-gradient($color2, $color1);
33
+ } //@if…
34
+ @else {
35
+ $color1: lighten($color, abs($top));
36
+ $color2: darken($color, abs($bottom));
37
+ @include background(linear-gradient(top, $color2, $color1));
38
+ @include filter-gradient($color2, $color1);
39
+ } //@else…
40
+ background-color: $color;
41
+ } //@mixin…
@@ -0,0 +1,13 @@
1
+ @import "compass/css3/images";
2
+
3
+ // Noise Mixin
4
+ @mixin noise($color: #fff, $color2: false, $intensity: 0.02, $image: "noise.jpg") {
5
+ background: $color;
6
+ $color: transparentize($color, $intensity);
7
+ @if $color2 == false {
8
+ $color2: $color;
9
+ } @else {
10
+ $color2: transparentize($color2, $intensity);
11
+ }
12
+ @include background(linear-gradient(top, $color, $color2), inline-image("#{$image}"));
13
+ } //@mixin…
@@ -0,0 +1,12 @@
1
+ //
2
+ // Source: https://gist.github.com/3859980
3
+ //
4
+
5
+ @mixin ms-rotate($degrees) {
6
+ @if (not unitless($degrees)) { $degrees: $degrees / 1deg }
7
+ $deg2rad: pi() * 2 / 360;
8
+ $radians: $degrees * $deg2rad;
9
+ $costheta: cos($radians);
10
+ $sintheta: sin($radians);
11
+ filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=#{$costheta}, M12=#{-$sintheta}, M21=#{$sintheta}, M22=#{$costheta});
12
+ }
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Apprise has been depricated.
3
+ * http://thrivingkings.com/read/Apprise-The-attractive-alert-alternative-for-jQuery
4
+ * TODO: Find Alternative
5
+ */
6
+
7
+ @mixin apprise {
8
+ .appriseOverlay {
9
+ position: fixed;
10
+ top: 0;
11
+ left: 0;
12
+ background: rgba(0, 0, 0, 0.3);
13
+ display: none;
14
+ } //.appriseOverlay
15
+
16
+ .appriseOuter {
17
+ background: #eee;
18
+ border: white 1px solid;
19
+ @include box-shadow(#333 0 3px 7px);
20
+ @include border-radius(4px);
21
+ position: absolute;
22
+ z-index: 300;
23
+ min-width: 200px;
24
+ min-height: 50px;
25
+ max-width: 75%;
26
+ position: fixed;
27
+ display: none;
28
+ } //.appriseOuter
29
+
30
+ .appriseInner {
31
+ padding: 20px;
32
+ color: #333;
33
+ @include text-shadow(white 0 1px 0);
34
+ button {
35
+ border: 1px solid #bbb;
36
+ @include border-radius(3px);
37
+ @include background(linear-gradient(top, #d5d5d5, #eee));
38
+ color: #232d3d;
39
+ font-size: 12px;
40
+ font-weight: bold;
41
+ padding: 4px 10px;
42
+ margin: 0 3px;
43
+ @include text-shadow(white 0 1px 0);
44
+ cursor: pointer;
45
+ @include box-shadow(#ccc 0 1px 2px);
46
+ &:hover {
47
+ color: #d85054;
48
+ } //&:hover
49
+ } //button
50
+ } //.appriseInner
51
+
52
+ .aButtons, .aInput {
53
+ margin: 20px 10px 0;
54
+ text-align: center;
55
+ } //.aButtons, .aInput
56
+
57
+ .aTextbox {
58
+ border: 1px solid #aaa;
59
+ @include border-radius(4px);
60
+ @include box-shadow(white 0 1px 0);
61
+ width: 180px;
62
+ font-size: 12px;
63
+ font-weight: bold;
64
+ padding: 5px 10px;
65
+ } //.aTextbox
66
+ }
@@ -0,0 +1,25 @@
1
+ @mixin image-2x($image, $width, $height) {
2
+ @media (min--moz-device-pixel-ratio: 1.3),
3
+ (-o-min-device-pixel-ratio: 2.6/2),
4
+ (-webkit-min-device-pixel-ratio: 1.3),
5
+ (min-device-pixel-ratio: 1.3),
6
+ (min-resolution: 1.3dppx) {
7
+ /* on retina, use image that's scaled by 2 */
8
+ background-image: url($image);
9
+ background-size: $width $height;
10
+ }
11
+ }
12
+
13
+ @mixin inline-image($image) {
14
+ background-image: inline-image("#{$image}");
15
+ *background-image: url("images/#{$image}");
16
+ }
17
+
18
+ @mixin inline-sprite($sprite-image, $width, $height) {
19
+ background-image: inline-image("#{$sprite-image}");
20
+ background-repeat: no-repeat;
21
+ width: $width;
22
+ height: $height;
23
+ overflow: hidden;
24
+ *background-image: url("../images/#{$sprite-image}");
25
+ }