red-palette 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/palette.rb +17 -0
- data/lib/palette/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f12b7fc4cf789b440ea06399e24819d4579a78ad85d13cd9f39098470ff52c1c
|
4
|
+
data.tar.gz: 73cce0dfa74982c73d927f548313a46a46310060423cfda3e848b3710c8adb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7e09883c5eb529d2c999aca1c297655d6d162fb3f49af18272dc29e947e1573597447f0d09e1e4592c1d02c444fc7c4200335fe814e362167251f2bba4beea
|
7
|
+
data.tar.gz: 1c017fc86fc8cfc3b178773ae17235e0094d215a382abc61e161fd3223fc9c84dda2caf24cf266b84b824ecfec02070510934a793c42d4bc3a88f9a0620cc7a2
|
data/lib/palette.rb
CHANGED
@@ -95,6 +95,23 @@ class Palette
|
|
95
95
|
@palette.dup
|
96
96
|
end
|
97
97
|
|
98
|
+
def to_iruby
|
99
|
+
["image/svg", to_svg]
|
100
|
+
end
|
101
|
+
|
102
|
+
def to_svg
|
103
|
+
w = 55
|
104
|
+
n = n_colors
|
105
|
+
svg = %Q[<svg width="#{n*w}" height="#{w}">]
|
106
|
+
@colors.each_with_index do |color, i|
|
107
|
+
hex = color.to_rgb.to_hex_string
|
108
|
+
svg << %Q[<rect x="#{i*w}" y="0" width="#{w}" height="#{w}" style="fill:#{hex};]
|
109
|
+
svg << %Q[stroke-width:2;stroke:rgb(255,255,255)"/>]
|
110
|
+
end
|
111
|
+
svg << %Q[</svg>]
|
112
|
+
svg
|
113
|
+
end
|
114
|
+
|
98
115
|
private def normalize_palette_name(palette)
|
99
116
|
case palette
|
100
117
|
when String
|
data/lib/palette/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red-palette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: red-colors
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.2.3
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Red Palette provides features for dealing with palette.
|