style_palette 0.0.5 → 0.0.7
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 +7 -0
- data/README.md +22 -19
- data/lib/style_palette/helper.rb +2 -2
- data/lib/style_palette/version.rb +1 -1
- data/test/helper_test.rb +2 -2
- metadata +30 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ff65d506da6f5ec5a50b7831c6d60001e29e1e6
|
4
|
+
data.tar.gz: 715013c4b9a7a5eb8ed93c4655efb48952ff5824
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 564077e1902f3629bd99d0fa55841d202ffc44523cb07813505e9bff8b696ef54a118873a3553de83429a0bff440ad28c30f7c4bc41b2d3db234e2fd8c4934f4
|
7
|
+
data.tar.gz: 0a4da8bf814fbec96a0e12293bd8a7dc3ef909d0889fbf3d92093506a68cf1f212f427d2ad4e804a1998a766c689e6bf99974976c3c869f61a843388545c3477
|
data/README.md
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|

|
2
2
|
|
3
|
-
#
|
3
|
+
# StylePalette
|
4
4
|
|
5
|
-
|
5
|
+
When you have a bunch of _tags_ and you want to render them in a colorize way you can implement your own colorize system or you can use **StylePalette**.
|
6
6
|
|
7
|
-
|
7
|
+
StylePalette offers a json based configured color collections that can be associate with words.
|
8
|
+
|
9
|
+
StylePalette offers also helpers to render already styled `.label` elements.
|
10
|
+
|
11
|
+
## The Gallery playground
|
8
12
|
|
9
|
-
|
10
|
-
cd StylePaletteGallery
|
13
|
+
You can check your _style palettes_ in the [StylePaletteGallery](http://stylepalettegallery.herokuapp.com/) or [fork the app](https://github.com/fguillen/StylePaletteGallery) and create your own playground.
|
11
14
|
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
gem "style_palette"
|
12
18
|
|
13
19
|
## Usage
|
14
20
|
|
@@ -17,7 +23,7 @@ Gallery playground to test the gem [StylePalette](https://github.com/fguillen/St
|
|
17
23
|
StylePalette.brush("cat", :tags).background # => #f5abd5
|
18
24
|
StylePalette.brush("cat", :tags).foreground # => #000
|
19
25
|
StylePalette::Helper.style("cat", :tags) # => background-color: #f5abd5; color: #000;
|
20
|
-
StylePalette::Helper.label("cat", :tags) # => <span class="
|
26
|
+
StylePalette::Helper.label("cat", :tags) # => <span class="badge" style="background-color: #f5abd5; color: #000;">cat</span>
|
21
27
|
|
22
28
|
## Configuration & Initialization
|
23
29
|
|
@@ -77,7 +83,7 @@ Use:
|
|
77
83
|
|
78
84
|
## Word/Color assignment
|
79
85
|
|
80
|
-
In the basic configuration
|
86
|
+
In the basic configuration StylePalette takes a random _color_ for each _word_ (**always the same color for each word**), this is very helpful when you don't really care about the associated color for each word, for example if you have docens of _tags_ you are not gonna assign one specific color to each _tag_ just create a big enough palette and let StylePalette to choose.
|
81
87
|
|
82
88
|
But if you want to _force_ a color for an specific word you can do it using the special _regex_ attribute for a color in this way:
|
83
89
|
|
@@ -103,9 +109,9 @@ Also check the next examples:
|
|
103
109
|
{ "style": "background-color: #E68585; color: #000;", "regex": "^-" }
|
104
110
|
],
|
105
111
|
|
106
|
-
StylePalette::Helper.label(0, :number) # => <span class="
|
107
|
-
StylePalette::Helper.label(123, :number) # => <span class="
|
108
|
-
StylePalette::Helper.label(-99, :number) # => <span class="
|
112
|
+
StylePalette::Helper.label(0, :number) # => <span class="badge" style="background-color: #CCCCCC; color: #000;">0</span>
|
113
|
+
StylePalette::Helper.label(123, :number) # => <span class="badge" style="background-color: #91E391; color: #000;">123</span>
|
114
|
+
StylePalette::Helper.label(-99, :number) # => <span class="badge" style="background-color: #E68585; color: #000;">-99</span>
|
109
115
|
|
110
116
|
* For _zero_ the first color will be choosen
|
111
117
|
* For _positive numbers_ the second color will be choosen
|
@@ -120,8 +126,8 @@ Also check the next examples:
|
|
120
126
|
{ "style": "background-color: #ff85f3; color: #000;", "range": "80.." }
|
121
127
|
]
|
122
128
|
|
123
|
-
StylePalette::Helper.label(0, :ranges) # => <span class="
|
124
|
-
StylePalette::Helper.label(45, :ranges) # => <span class="
|
129
|
+
StylePalette::Helper.label(0, :ranges) # => <span class="badge" style="background-color: #fff385; color: #000;">0</span>
|
130
|
+
StylePalette::Helper.label(45, :ranges) # => <span class="badge" style="background-color: #85c2ff; color: #000;">45</span>
|
125
131
|
|
126
132
|
### Boolean assignment
|
127
133
|
|
@@ -130,15 +136,12 @@ Also check the next examples:
|
|
130
136
|
{ "style": "background-color: #E68585; color: #000;", "regex": "^(no|0|false)$" }
|
131
137
|
],
|
132
138
|
|
133
|
-
StylePalette::Helper.label(0, :boolean) # => <span class="
|
134
|
-
StylePalette::Helper.label("no", :boolean) # => <span class="
|
135
|
-
StylePalette::Helper.label("yes", :boolean) # => <span class="
|
136
|
-
StylePalette::Helper.label(true, :boolean) # => <span class="
|
139
|
+
StylePalette::Helper.label(0, :boolean) # => <span class="badge" style="background-color: #91E391; color: #000;">0</span>
|
140
|
+
StylePalette::Helper.label("no", :boolean) # => <span class="badge" style="background-color: #91E391; color: #000;">no</span>
|
141
|
+
StylePalette::Helper.label("yes", :boolean) # => <span class="badge" style="background-color: #E68585; color: #000;">yes</span>
|
142
|
+
StylePalette::Helper.label(true, :boolean) # => <span class="badge" style="background-color: #E68585; color: #000;">true</span>
|
137
143
|
|
138
144
|
|
139
|
-
## The Gallery playground
|
140
|
-
|
141
|
-
You can check your _style palettes_ in the [StylePaletteGallery](http://stylepalettegallery.fernandoguillen.info/) or [fork the app](https://github.com/fguillen/StylePaletteGallery) and create your own playground.
|
142
145
|
|
143
146
|
|
144
147
|
|
data/lib/style_palette/helper.rb
CHANGED
data/test/helper_test.rb
CHANGED
@@ -6,6 +6,6 @@ class HelperTest < MiniTest::Unit::TestCase
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_label
|
9
|
-
assert_equal("<span class=\"
|
9
|
+
assert_equal("<span class=\"badge\" style=\"style 10\">a</span>", StylePalette::Helper.label("a", :tags))
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,49 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: style_palette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Fernando Guillen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-12-31 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rake
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: mocha
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - ">="
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
description: Create collections of stylized labels without effort
|
48
56
|
email:
|
49
57
|
- fguillen.mail@gmail.com
|
@@ -51,8 +59,8 @@ executables: []
|
|
51
59
|
extensions: []
|
52
60
|
extra_rdoc_files: []
|
53
61
|
files:
|
54
|
-
- .gitignore
|
55
|
-
- .rvmrc.example
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rvmrc.example"
|
56
64
|
- Gemfile
|
57
65
|
- Gemfile.lock
|
58
66
|
- LICENSE.txt
|
@@ -72,27 +80,26 @@ files:
|
|
72
80
|
homepage: https://github.com/fguillen/StylePalette
|
73
81
|
licenses:
|
74
82
|
- MIT
|
83
|
+
metadata: {}
|
75
84
|
post_install_message:
|
76
85
|
rdoc_options: []
|
77
86
|
require_paths:
|
78
87
|
- lib
|
79
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
89
|
requirements:
|
82
|
-
- -
|
90
|
+
- - ">="
|
83
91
|
- !ruby/object:Gem::Version
|
84
92
|
version: '0'
|
85
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
94
|
requirements:
|
88
|
-
- -
|
95
|
+
- - ">="
|
89
96
|
- !ruby/object:Gem::Version
|
90
97
|
version: '0'
|
91
98
|
requirements: []
|
92
99
|
rubyforge_project:
|
93
|
-
rubygems_version:
|
100
|
+
rubygems_version: 2.5.1
|
94
101
|
signing_key:
|
95
|
-
specification_version:
|
102
|
+
specification_version: 4
|
96
103
|
summary: Create collections of stylized labels without effort
|
97
104
|
test_files:
|
98
105
|
- test/fixtures/file.json
|