swipe_title 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/swipe_title/ui_color.rb +23 -0
- data/lib/swipe_title/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43e0592a411d2f7451db75f6f4d762f3ba172713
|
4
|
+
data.tar.gz: d85f2b7be265250b6433483af68ee2953c227747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42de905c74ad788cb1592fdd30d1e826ab3c26741b1d3858a5e57526e2c6c35088ed49f7cada1b85ac4daae93a36159109e4f02cded4cf3ecc137d520cdc4956
|
7
|
+
data.tar.gz: bc0e7e293ee11f85237c2145689d96a04bf5cac2747bf65c7d848ddc8231e58c4b51d6360f1a9dc67fb6154b9d9981671d1e68e89bca71d0afe1eb9373332f9f
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class UIColor
|
2
|
+
def self.[](str)
|
3
|
+
# Next attempt to convert from hex
|
4
|
+
hex_color = str.gsub("#", "")
|
5
|
+
case hex_color.size
|
6
|
+
when 3
|
7
|
+
colors = hex_color.scan(%r{[0-9A-Fa-f]}).map{ |el| (el * 2).to_i(16) }
|
8
|
+
when 6
|
9
|
+
colors = hex_color.scan(%r<[0-9A-Fa-f]{2}>).map{ |el| el.to_i(16) }
|
10
|
+
else
|
11
|
+
raise ArgumentError
|
12
|
+
end
|
13
|
+
if colors.size == 3
|
14
|
+
UIColor.colorWithRed((colors[0]/255.0), green:(colors[1]/255.0), blue:(colors[2]/255.0), alpha:1)
|
15
|
+
else
|
16
|
+
raise ArgumentError
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.withNamedImage name
|
21
|
+
self.colorWithPatternImage(UIImage.imageNamed(name))
|
22
|
+
end
|
23
|
+
end
|
data/lib/swipe_title/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swipe_title
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/swipe_title/swipe_title_controller.rb
|
44
44
|
- lib/swipe_title/swipe_title_layout.rb
|
45
45
|
- lib/swipe_title/title_page.rb
|
46
|
+
- lib/swipe_title/ui_color.rb
|
46
47
|
- lib/swipe_title/version.rb
|
47
48
|
- spec/spec_helper.rb
|
48
49
|
- spec/swipe_title_spec.rb
|