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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ba011b63e8f0ce2e3d6031b7f49007357c3ad67
4
- data.tar.gz: a1fc893e429976ea4091e63151c2162114dd2fb2
3
+ metadata.gz: 43e0592a411d2f7451db75f6f4d762f3ba172713
4
+ data.tar.gz: d85f2b7be265250b6433483af68ee2953c227747
5
5
  SHA512:
6
- metadata.gz: 85f535445d88f2470f06e6ae196a0f7316a4e5e38ec9f066facf82ee2254806161d59eee9d30cc3f5307560580ccded73f87789fd9d6a5422d99cd76fbdf8b29
7
- data.tar.gz: d30e3b7e3654b37473f8447cd2a470b4f900a64dcca2fd1ff6f1907ed43bf85c55d86e3ea29bf969652d9007620806fb679f5320d1c22cbe17b0ba6aa9dd8cd0
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
@@ -1,3 +1,3 @@
1
1
  module SwipeTitle
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
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