patterner 0.0.1b
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkdn +108 -0
- data/lib/patterner.rb +5 -0
- data/lib/patterner/patterner.rb +32 -0
- data/lib/patterner/patterner/patterns.rb +59 -0
- data/lib/patterner/patterner/patterns/checker.rb +32 -0
- data/lib/patterner/patterner/patterns/crosshatch.rb +19 -0
- data/lib/patterner/patterner/patterns/diamond.rb +29 -0
- data/lib/patterner/patterner/patterns/dots.rb +47 -0
- data/lib/patterner/patterner/patterns/grids.rb +63 -0
- data/lib/patterner/patterner/patterns/plus.rb +26 -0
- data/lib/patterner/patterner/patterns/stripes.rb +94 -0
- data/lib/patterner/patterner/patterns/zigzag.rb +41 -0
- data/templates/project/manifest.rb +4 -0
- data/templates/project/patterner.html +29 -0
- data/templates/project/patterner.sass +56 -0
- metadata +114 -0
data/README.mkdn
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
Patterner
|
2
|
+
==========
|
3
|
+
|
4
|
+
Patterner is a compass extension that contains a library of customizable patterns for use as background images. Images are outputted as base64 data url png using the [chunky_png library](https://github.com/wvanbergen/chunky_png). The png images outputted are transparent so where is no pattern the background color will show through, the patterns themselves can also be transparent when setting the color of the pattern using an hsla or rgba color. You can see a quick demo of the patterns [here](http://dl.dropbox.com/u/1274637/patterns/patterner.html)
|
5
|
+
|
6
|
+
Installation
|
7
|
+
-------------
|
8
|
+
|
9
|
+
From the command like
|
10
|
+
|
11
|
+
(sudo) gem install patterner
|
12
|
+
|
13
|
+
Adding to an existing compass project
|
14
|
+
|
15
|
+
#Edit the project configuration file
|
16
|
+
require 'patterner'
|
17
|
+
|
18
|
+
#From command line
|
19
|
+
compass install patterner
|
20
|
+
|
21
|
+
Creating a new project based on patterner
|
22
|
+
|
23
|
+
#From command line
|
24
|
+
compass create <project_name> -r patterner --using patterner
|
25
|
+
|
26
|
+
|
27
|
+
Patterner usage
|
28
|
+
---------------
|
29
|
+
|
30
|
+
Patterner currently has a library of 8 customizable patterns (checkers, crosshatch, diamond, dots [normal and offset], grids [grid and blueprint], plus, stripes [horizontal, vertical, forwards, and backwards], and zigzag)
|
31
|
+
|
32
|
+
To use a pattern you call the pattern function on a css selector's background property and declare what pattern you would like to use and the color of the pattern. Below is an example of creating checker pattern for a div
|
33
|
+
|
34
|
+
div {
|
35
|
+
background: pattern(checker, black);
|
36
|
+
}
|
37
|
+
|
38
|
+
Most patterns have optional arguments that let you customize the pattern including the size, spacing, and some have an optional secondary color. Below is an example of calling the checker pattern with the optional arguments
|
39
|
+
|
40
|
+
#checker pattern with optional arguments: pattern(checker, color, size of squares, optional second color)
|
41
|
+
|
42
|
+
div {
|
43
|
+
background: pattern(checker, #333, 50, #ccc);
|
44
|
+
}
|
45
|
+
|
46
|
+
### Full pattern argument listings
|
47
|
+
Only pattern style and color are required, all other arguments are optional and used for customizing the pattern
|
48
|
+
|
49
|
+
#### Checker
|
50
|
+
|
51
|
+
pattern(checker, color, square size, second color)
|
52
|
+
|
53
|
+
#### Crosshatch
|
54
|
+
pattern(crosshatch, line color, line size, secondary line color)
|
55
|
+
|
56
|
+
#### Diamond
|
57
|
+
pattern(diamond, color, height, width)
|
58
|
+
|
59
|
+
#### Dots
|
60
|
+
# Normal
|
61
|
+
pattern(dots, color, dot size, dot spacing)
|
62
|
+
|
63
|
+
# Offset
|
64
|
+
pattern(offset-dots, color, dot size, dot spacing)
|
65
|
+
|
66
|
+
#### Grid
|
67
|
+
# Grid
|
68
|
+
pattern(grid, color, size)
|
69
|
+
|
70
|
+
# Blueprint
|
71
|
+
pattern(blueprint, color, size)
|
72
|
+
|
73
|
+
#### Plus
|
74
|
+
# Plus
|
75
|
+
pattern(plus, color, size, spacing)
|
76
|
+
|
77
|
+
#### Stripes
|
78
|
+
|
79
|
+
# Horizontal
|
80
|
+
pattern(horizontal-stripe, color, stripe width, spacing)
|
81
|
+
- or -
|
82
|
+
pattern(h-stripe, color, stripe width, spacing)
|
83
|
+
|
84
|
+
# Vertical
|
85
|
+
pattern(vertical-stripe, color, stripe width, spacing)
|
86
|
+
- or -
|
87
|
+
pattern(v-stripe, color, stripe width, spacing)
|
88
|
+
|
89
|
+
# Forward diagonal
|
90
|
+
pattern(forward-stripe, color, stripe width, spacing)
|
91
|
+
- or -
|
92
|
+
pattern(f-stripe, color, stripe width, spacing)
|
93
|
+
|
94
|
+
# Backward diagonal
|
95
|
+
pattern(backward-stripe, color, stripe width, spacing)
|
96
|
+
- or -
|
97
|
+
pattern(b-stripe, color, stripe width, spacing)
|
98
|
+
|
99
|
+
#### Zigzag
|
100
|
+
# Zigzag
|
101
|
+
pattern(zigzag, height, width, spacing)
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
data/lib/patterner.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "chunky_png"
|
3
|
+
require "base64"
|
4
|
+
require "patterner/patterner/patterns.rb"
|
5
|
+
|
6
|
+
|
7
|
+
module Sass::Script::Functions
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
TRANSPARENT = ChunkyPNG::Color::TRANSPARENT
|
12
|
+
|
13
|
+
|
14
|
+
def return_image(png)
|
15
|
+
|
16
|
+
data = Base64.encode64(png.to_blob).gsub("\n", "")
|
17
|
+
Sass::Script::String.new("url('data:image/png;base64,#{data}')")
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
def get_color(color)
|
24
|
+
color = ChunkyPNG::Color.rgba(color.red, color.green, color.blue, (color.alpha*255).round)
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "patterner/patterner/patterns/checker.rb"
|
2
|
+
require "patterner/patterner/patterns/crosshatch.rb"
|
3
|
+
require "patterner/patterner/patterns/diamond.rb"
|
4
|
+
require "patterner/patterner/patterns/dots.rb"
|
5
|
+
require "patterner/patterner/patterns/grids.rb"
|
6
|
+
require "patterner/patterner/patterns/plus.rb"
|
7
|
+
require "patterner/patterner/patterns/stripes.rb"
|
8
|
+
require "patterner/patterner/patterns/zigzag.rb"
|
9
|
+
|
10
|
+
module Patron
|
11
|
+
class Patterns
|
12
|
+
module Sass::Script::Functions
|
13
|
+
|
14
|
+
def pattern(style, arg1, arg2 = nil, arg3 = nil, arg4 = nil)
|
15
|
+
|
16
|
+
style = style.to_s if style.is_a? Sass::Script::String
|
17
|
+
|
18
|
+
case style
|
19
|
+
when "checker"
|
20
|
+
checker(arg1, arg2, arg3)
|
21
|
+
when "crosshatch"
|
22
|
+
crosshatch(arg1, arg2, arg3, arg4)
|
23
|
+
when "diamond"
|
24
|
+
diamond(arg1, arg2, arg3)
|
25
|
+
when "dots"
|
26
|
+
dots(arg1, arg2, arg3)
|
27
|
+
when "offset-dots"
|
28
|
+
offsetdots(arg1, arg2, arg3)
|
29
|
+
when "grid"
|
30
|
+
grid(arg1, arg2)
|
31
|
+
when "blueprint"
|
32
|
+
blueprint(arg1, arg2)
|
33
|
+
when "plus"
|
34
|
+
plus(arg1, arg2, arg3)
|
35
|
+
when "horizontal-stripe", "h-stripe"
|
36
|
+
stripe("h", arg1, arg2, arg3)
|
37
|
+
when "vertical-stripe", "v-stripe"
|
38
|
+
stripe("v", arg1, arg2, arg3)
|
39
|
+
when "forward-stripe", "f-stripe"
|
40
|
+
stripe("f", arg1, arg2, arg3)
|
41
|
+
when "backward-stripe", "b-stripe"
|
42
|
+
stripe("b", arg1, arg2, arg3)
|
43
|
+
when "zigzag"
|
44
|
+
zigzag(arg1, arg2, arg3, arg4)
|
45
|
+
else
|
46
|
+
Sass::Tree::WarnNode.new("No pattern named #{style} found")
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def checker(c1, size, c2 = nil)
|
4
|
+
|
5
|
+
size = 20 if size.nil?
|
6
|
+
|
7
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
8
|
+
|
9
|
+
c1 = get_color(c1)
|
10
|
+
|
11
|
+
total_size = (size*2)
|
12
|
+
|
13
|
+
|
14
|
+
png = ChunkyPNG::Image.new(total_size, total_size, TRANSPARENT)
|
15
|
+
|
16
|
+
png.rect(0, 0, size-1, size-1, TRANSPARENT, c1)
|
17
|
+
|
18
|
+
png.rect(size,size,total_size, total_size, TRANSPARENT, c1)
|
19
|
+
|
20
|
+
|
21
|
+
unless c2.nil?
|
22
|
+
c2 = get_color(c2)
|
23
|
+
png.rect(size, 0, total_size, size-1, TRANSPARENT, c2)
|
24
|
+
png.rect(0, size, size-1, total_size, TRANSPARENT, c2)
|
25
|
+
end
|
26
|
+
|
27
|
+
return_image(png)
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def crosshatch(c1, size = 1, spacing = 20, c2 = nil)
|
4
|
+
|
5
|
+
size = 1 if size.nil?
|
6
|
+
spacing = 20 if spacing.nil?
|
7
|
+
|
8
|
+
if c2.nil?
|
9
|
+
c2 = c1
|
10
|
+
end
|
11
|
+
|
12
|
+
front = stripe("f", c1, size, spacing)
|
13
|
+
back = stripe("b", c2, size, spacing)
|
14
|
+
|
15
|
+
Sass::Script::String.new("#{front}, #{back}")
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def diamond(c, height = 25, width = 35)
|
4
|
+
|
5
|
+
height = 25 if height.nil?
|
6
|
+
width = 35 if width.nil?
|
7
|
+
|
8
|
+
height = height.to_i if height.is_a? Sass::Script::Number
|
9
|
+
width = width.to_i if width.is_a? Sass::Script::Number
|
10
|
+
|
11
|
+
c = get_color(c)
|
12
|
+
|
13
|
+
top = ChunkyPNG::Image.new(width, height, TRANSPARENT)
|
14
|
+
bottom = ChunkyPNG::Image.new(width, height, TRANSPARENT)
|
15
|
+
png = ChunkyPNG::Image.new(width, (height*2), TRANSPARENT)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
top.polygon([width/2,-1,0,height,width,height], TRANSPARENT, c)
|
20
|
+
bottom = bottom.compose(top, 0, 0)
|
21
|
+
bottom = bottom.flip_horizontally
|
22
|
+
png = png.compose(top, 0, 0)
|
23
|
+
png = png.compose(bottom, 0, height)
|
24
|
+
|
25
|
+
return_image(png)
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def dots(c, size, spacing)
|
4
|
+
|
5
|
+
size = 5 if size.nil?
|
6
|
+
spacing = 10 if spacing.nil?
|
7
|
+
|
8
|
+
|
9
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
10
|
+
spacing = spacing.to_i if spacing.is_a? Sass::Script::Number
|
11
|
+
|
12
|
+
total_size = (size*2)+spacing
|
13
|
+
c = get_color(c)
|
14
|
+
|
15
|
+
total_size = (size*2)+spacing
|
16
|
+
png = ChunkyPNG::Image.new(total_size, total_size, TRANSPARENT)
|
17
|
+
png.circle(size,size, size, TRANSPARENT, c)
|
18
|
+
|
19
|
+
return_image(png)
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def offsetdots(c, size, spacing)
|
24
|
+
size = 5 if size.nil?
|
25
|
+
spacing = 10 if spacing.nil?
|
26
|
+
|
27
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
28
|
+
spacing = spacing.to_i if spacing.is_a? Sass::Script::Number
|
29
|
+
|
30
|
+
total_size = (size*4)+spacing
|
31
|
+
c = get_color(c)
|
32
|
+
png = ChunkyPNG::Image.new(total_size, total_size, TRANSPARENT)
|
33
|
+
|
34
|
+
png.circle(0, total_size/2, size, TRANSPARENT, c)
|
35
|
+
png.circle(total_size, total_size/2, size, TRANSPARENT, c)
|
36
|
+
png.circle(total_size/2, 0, size, TRANSPARENT, c)
|
37
|
+
png.circle(total_size/2, total_size, size, TRANSPARENT, c)
|
38
|
+
|
39
|
+
|
40
|
+
return_image(png)
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def grid(c, size)
|
4
|
+
size = 25 if size.nil?
|
5
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
6
|
+
|
7
|
+
c = get_color(c)
|
8
|
+
|
9
|
+
png = ChunkyPNG::Image.new(size, size, TRANSPARENT)
|
10
|
+
|
11
|
+
png.line(size/2, 0, size/2, size, c)
|
12
|
+
png.line(0, size/2, size, size/2, c)
|
13
|
+
|
14
|
+
return_image(png)
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def blueprint(c, size)
|
19
|
+
size = 75 if size.nil?
|
20
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
21
|
+
c = get_color(c)
|
22
|
+
png = ChunkyPNG::Image.new(size, size, TRANSPARENT)
|
23
|
+
|
24
|
+
spacing = size/3
|
25
|
+
|
26
|
+
png.rect(size-1, 0, size, size, TRANSPARENT,c)
|
27
|
+
png.rect(0, size-1, size, size, TRANSPARENT,c)
|
28
|
+
|
29
|
+
for x in (0...spacing)
|
30
|
+
png.line(spacing*x, 0, spacing*x, size, c)
|
31
|
+
png.line(0, spacing*x, size, spacing*x, c)
|
32
|
+
end
|
33
|
+
|
34
|
+
return_image(png)
|
35
|
+
end
|
36
|
+
|
37
|
+
def grid_overlay(columns, column_width, gutter_width, c = nil)
|
38
|
+
|
39
|
+
columns = columns.to_i if columns.is_a? Sass::Script::Number
|
40
|
+
column_width = column_width.to_i if column_width.is_a? Sass::Script::Number
|
41
|
+
gutter_width = gutter_width.to_i if gutter_width.is_a? Sass::Script::Number
|
42
|
+
grid_width = ((column_width + gutter_width) * columns) - gutter_width
|
43
|
+
|
44
|
+
|
45
|
+
if c.nil?
|
46
|
+
grid_color = ChunkyPNG::Color.rgba(255, 0, 0, 150)
|
47
|
+
else
|
48
|
+
grid_color = ChunkyPNG::Color.rgba(c.red, c.green, c.blue, (c.alpha * 255).round)
|
49
|
+
end
|
50
|
+
|
51
|
+
png = ChunkyPNG::Image.new(grid_width, 25, ChunkyPNG::Color::TRANSPARENT)
|
52
|
+
|
53
|
+
|
54
|
+
for i in (0..columns)
|
55
|
+
png.rect((column_width+gutter_width)*i, 0, ((column_width+gutter_width)*i)+column_width, 25, ChunkyPNG::Color::TRANSPARENT, grid_color)
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
return_image(png)
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def plus(c, size, spacing)
|
4
|
+
size = 5 if size.nil?
|
5
|
+
spacing = 10 if spacing.nil?
|
6
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
7
|
+
spacing = spacing.to_i if spacing.is_a? Sass::Script::Number
|
8
|
+
|
9
|
+
total_size = size+spacing
|
10
|
+
|
11
|
+
c = get_color(c)
|
12
|
+
|
13
|
+
png = ChunkyPNG::Image.new(total_size, total_size, TRANSPARENT)
|
14
|
+
|
15
|
+
size%2 == 0 ? size = size : size = size+1
|
16
|
+
|
17
|
+
|
18
|
+
png.line(size/2, 0, size/2, size, c)
|
19
|
+
png.line(0, size/2, size, size/2, c)
|
20
|
+
|
21
|
+
return_image(png)
|
22
|
+
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def stripe(type, c, size, spacing)
|
4
|
+
|
5
|
+
size = 1 if size.nil?
|
6
|
+
spacing = 10 if spacing.nil?
|
7
|
+
|
8
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
9
|
+
spacing = spacing.to_i if spacing.is_a? Sass::Script::Number
|
10
|
+
type = type.to_s if type.is_a? Sass::Script::String
|
11
|
+
total_size = (size+spacing)
|
12
|
+
line_color = get_color(c)
|
13
|
+
png = ChunkyPNG::Image.new(total_size, total_size, ChunkyPNG::Color::TRANSPARENT)
|
14
|
+
|
15
|
+
|
16
|
+
# horizontal stripe
|
17
|
+
if type == "horizontal" || type == "h"
|
18
|
+
for x in (0...total_size)
|
19
|
+
for y in (0...size)
|
20
|
+
png.set_pixel(x, y, line_color)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
# vertical stripe
|
27
|
+
if type == "vertical" || type == "v"
|
28
|
+
for y in (0...total_size)
|
29
|
+
for x in (0...size)
|
30
|
+
png.set_pixel(x, y, line_color)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
starting_point = size
|
36
|
+
total_points = size
|
37
|
+
|
38
|
+
#Forward Stripe
|
39
|
+
if type == "forward" || type == "f"
|
40
|
+
for y in (0...total_size)
|
41
|
+
for x in (0...total_size)
|
42
|
+
if x < size
|
43
|
+
|
44
|
+
point = starting_point-x
|
45
|
+
|
46
|
+
if point < 0
|
47
|
+
point = point + total_size
|
48
|
+
end
|
49
|
+
|
50
|
+
png.set_pixel(point, y, line_color)
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
starting_point = starting_point-1
|
56
|
+
|
57
|
+
if starting_point < 0
|
58
|
+
starting_point = total_size-1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
#Backwards Stipe
|
65
|
+
if type == "back" || type == "b"
|
66
|
+
|
67
|
+
for y in (0...total_size)
|
68
|
+
for x in (0...total_size)
|
69
|
+
if x < size
|
70
|
+
point = starting_point+x
|
71
|
+
|
72
|
+
if point > total_size-1
|
73
|
+
point = point - total_size
|
74
|
+
end
|
75
|
+
|
76
|
+
png.set_pixel(point, y, line_color)
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
starting_point = starting_point+1
|
82
|
+
|
83
|
+
if starting_point > total_size-1
|
84
|
+
starting_point = 0
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
return_image(png)
|
90
|
+
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Sass::Script::Functions
|
2
|
+
|
3
|
+
def zigzag(c, size, width, spacing)
|
4
|
+
size = 20 if size.nil?
|
5
|
+
width = 20 if width.nil?
|
6
|
+
spacing = 0 if spacing.nil?
|
7
|
+
size = size.to_i if size.is_a? Sass::Script::Number
|
8
|
+
width = width.to_i if width.is_a? Sass::Script::Number
|
9
|
+
spacing = spacing.to_i if spacing.is_a? Sass::Script::Number
|
10
|
+
|
11
|
+
height = size+width
|
12
|
+
|
13
|
+
c = get_color(c)
|
14
|
+
|
15
|
+
point = 0
|
16
|
+
|
17
|
+
spacing = spacing + height
|
18
|
+
|
19
|
+
left = ChunkyPNG::Image.new(width, height, TRANSPARENT)
|
20
|
+
right = ChunkyPNG::Image.new(width, height, TRANSPARENT)
|
21
|
+
png = ChunkyPNG::Image.new(width*2, spacing, TRANSPARENT)
|
22
|
+
|
23
|
+
for x in (0...width)
|
24
|
+
for y in (0...size)
|
25
|
+
left.set_pixel(x, y+point, c)
|
26
|
+
end
|
27
|
+
|
28
|
+
point = point+1
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
right = right.compose(left, 0, 0)
|
33
|
+
right = right.flip_vertically
|
34
|
+
png = png.compose(left, 0, 0)
|
35
|
+
png = png.compose(right,width,0)
|
36
|
+
|
37
|
+
return_image(png)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Patterner Examples</title>
|
6
|
+
|
7
|
+
<!-- link the compiled provided patterner css file here -->
|
8
|
+
<link href="stylesheets/patterner.css" media="screen, projection" rel="stylesheet" type="text/css" />
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<h1>Example patterns</h1>
|
13
|
+
|
14
|
+
<div class="patterner checker"></div>
|
15
|
+
<div class="patterner crosshatch"></div>
|
16
|
+
<div class="patterner diamond"></div>
|
17
|
+
<div class="patterner dots"></div>
|
18
|
+
<div class="patterner offset-dots"></div>
|
19
|
+
<div class="patterner grid"></div>
|
20
|
+
<div class="patterner blueprint"></div>
|
21
|
+
<div class="patterner plus"></div>
|
22
|
+
<div class="patterner horizontal-stripes"></div>
|
23
|
+
<div class="patterner vertical-stripes"></div>
|
24
|
+
<div class="patterner forward-stripes"></div>
|
25
|
+
<div class="patterner backwards-stripes"></div>
|
26
|
+
<div class="patterner zigzag"></div>
|
27
|
+
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
// Example usage
|
2
|
+
// All examples use all the arguments for you to explore and experiemnt with, only the pattern stlye and color are required
|
3
|
+
.patterner
|
4
|
+
width: 300px
|
5
|
+
height: 300px
|
6
|
+
float: left
|
7
|
+
margin: 25px
|
8
|
+
&:hover
|
9
|
+
background-color: #333
|
10
|
+
|
11
|
+
// Checker
|
12
|
+
.checker
|
13
|
+
background: pattern(checker, #333333, 50, hsla(0, 0, 70, 0.5))
|
14
|
+
|
15
|
+
// Crosshatch
|
16
|
+
.crosshatch
|
17
|
+
background: pattern(crosshatch, hsla(318, 100, 50, 1), 1, 20, hsla(33, 100, 50, 1))
|
18
|
+
|
19
|
+
// Diamond
|
20
|
+
.diamond
|
21
|
+
background: pattern(diamond, hsla(180, 50, 50, 1), 25, 30)
|
22
|
+
|
23
|
+
// Dots
|
24
|
+
.dots
|
25
|
+
background: pattern(dots, hsla(0, 50, 50, 1), 10, 20)
|
26
|
+
|
27
|
+
.offset-dots
|
28
|
+
background: pattern(offset-dots, #cccccc, 20, 5)
|
29
|
+
|
30
|
+
// Grids
|
31
|
+
.grid
|
32
|
+
background: pattern(grid, #e6a031, 25)
|
33
|
+
|
34
|
+
.blueprint
|
35
|
+
background: pattern(blueprint, teal, 75)
|
36
|
+
|
37
|
+
// Plus
|
38
|
+
.plus
|
39
|
+
background: pattern(plus, green, 10, 15)
|
40
|
+
|
41
|
+
// Stripes
|
42
|
+
.horizontal-stripes
|
43
|
+
background: pattern(horizontal-stripe, teal, 20, 10)
|
44
|
+
|
45
|
+
.vertical-stripes
|
46
|
+
background: pattern(vertical-stripe, #a95ec5, 10, 20)
|
47
|
+
|
48
|
+
.forward-stripes
|
49
|
+
background: pattern(forward-stripe, hsla(12, 100, 61, 1), 1, 10)
|
50
|
+
|
51
|
+
.backwards-stripes
|
52
|
+
background: pattern(backward-stripe, hsla(220, 80, 60, 0.8), 10, 25)
|
53
|
+
|
54
|
+
// Zigzag
|
55
|
+
.zigzag
|
56
|
+
background: pattern(zigzag, hsla(90, 80, 45, 0.8), 20, 25, 5)
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: patterner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 47
|
5
|
+
prerelease: 5
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
- b
|
11
|
+
version: 0.0.1b
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Jared Hardy
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-04-16 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: compass
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 62196225
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 11
|
33
|
+
- beta
|
34
|
+
- 5
|
35
|
+
version: 0.11.beta.5
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: chunky_png
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 19
|
47
|
+
segments:
|
48
|
+
- 1
|
49
|
+
- 1
|
50
|
+
- 0
|
51
|
+
version: 1.1.0
|
52
|
+
type: :runtime
|
53
|
+
version_requirements: *id002
|
54
|
+
description: a pattern generator for compass
|
55
|
+
email: jared@jaredhardy.com
|
56
|
+
executables: []
|
57
|
+
|
58
|
+
extensions: []
|
59
|
+
|
60
|
+
extra_rdoc_files: []
|
61
|
+
|
62
|
+
files:
|
63
|
+
- README.mkdn
|
64
|
+
- lib/patterner/patterner/patterns/checker.rb
|
65
|
+
- lib/patterner/patterner/patterns/crosshatch.rb
|
66
|
+
- lib/patterner/patterner/patterns/diamond.rb
|
67
|
+
- lib/patterner/patterner/patterns/dots.rb
|
68
|
+
- lib/patterner/patterner/patterns/grids.rb
|
69
|
+
- lib/patterner/patterner/patterns/plus.rb
|
70
|
+
- lib/patterner/patterner/patterns/stripes.rb
|
71
|
+
- lib/patterner/patterner/patterns/zigzag.rb
|
72
|
+
- lib/patterner/patterner/patterns.rb
|
73
|
+
- lib/patterner/patterner.rb
|
74
|
+
- lib/patterner.rb
|
75
|
+
- templates/project/manifest.rb
|
76
|
+
- templates/project/patterner.html
|
77
|
+
- templates/project/patterner.sass
|
78
|
+
homepage: http://www.jaredhardy.com
|
79
|
+
licenses: []
|
80
|
+
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 25
|
101
|
+
segments:
|
102
|
+
- 1
|
103
|
+
- 3
|
104
|
+
- 1
|
105
|
+
version: 1.3.1
|
106
|
+
requirements: []
|
107
|
+
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 1.7.2
|
110
|
+
signing_key:
|
111
|
+
specification_version: 3
|
112
|
+
summary: a pattern generator for compass
|
113
|
+
test_files: []
|
114
|
+
|