obf 0.2.5 → 0.2.6

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: 7e1b5472c682875d9a7105a13e5d8c082755b708
4
- data.tar.gz: c2f86abbb91ed2b93a4a7ef249ecb20378c0a9a0
3
+ metadata.gz: 0c27601024bf7909871b16237383f37f1293e735
4
+ data.tar.gz: dd85480dd2a3c0761e0822c7f7807c69d29695d4
5
5
  SHA512:
6
- metadata.gz: dc5bb78ba9ac04762f648e13d88fe6c55ab13e7ab900f56fcea0b98b96e2fe8126e81535350e9b98fa2c2d47c09e3fbbc0516b356618e3aa6c104c1b920a7b0e
7
- data.tar.gz: 09780a4f5476a8993fa9dbd76ce298e80f84da98aa08660246718417d889dffe0cbb5d5637b63c10f256c901e149ef4b47dacdad950c4da12c5974e5ddf4ddf9
6
+ metadata.gz: c6dc3bd80f1cb84236f42d527d676c3628e72d226c1eb67d142143f015c0a4616f7449679f0fb3ede3a583ae7c8acdd27077216d469fb8b769137834a028fff5
7
+ data.tar.gz: 98d650f28f82ef7d93f6f97b8ec7da80a1b4e130209a39653faa0f806fd262e4f6b8f5d40465ae22eac6a0f6de80f73fc43cb14832eadb2fe04ec99f9991a5c6
data/lib/obf/external.rb CHANGED
@@ -28,12 +28,13 @@ module OBF::External
28
28
  'id' => original_button['id'],
29
29
  'label' => original_button['label'],
30
30
  'vocalization' => original_button['vocalization'],
31
+ 'action' => original_button['action'],
31
32
  'left' => original_button['left'],
32
33
  'top' => original_button['top'],
33
34
  'width' => original_button['width'],
34
35
  'height' => original_button['height'],
35
- 'border_color' => original_button['border_color'] || "#aaa",
36
- 'background_color' => original_button['background_color'] || "#fff"
36
+ 'border_color' => OFB::Utils.fix_color(original_button['border_color'] || "#aaa", 'rgb'),
37
+ 'background_color' => OBF::Utils.fix_color(original_button['background_color'] || "#fff", 'rgb')
37
38
  }
38
39
  if original_button['load_board']
39
40
  button['load_board'] = {
data/lib/obf/pdf.rb CHANGED
@@ -48,14 +48,6 @@ module OBF::PDF
48
48
  end
49
49
  end
50
50
 
51
- def self.fix_color(str)
52
- @@colors ||= {}
53
- return @@colors[str] if @@colors[str]
54
- color = `node lib/tinycolor_convert.js "#{str}"`.strip
55
- @@colors[str] = color
56
- color
57
- end
58
-
59
51
  def self.build_page(pdf, obj, options)
60
52
  OBF::Utils.as_progress_percent(0, 1.0) do
61
53
  doc_width = 11*72 - 72
@@ -116,10 +108,10 @@ module OBF::PDF
116
108
  fill = "ffffff"
117
109
  border = "eeeeee"
118
110
  if button['background_color']
119
- fill = fix_color(button['background_color'])
111
+ fill = OBF::Utils.fix_color(button['background_color'], 'hex')
120
112
  end
121
113
  if button['border_color']
122
- border = fix_color(button['border_color'])
114
+ border = OBF::Utils.fix_color(button['border_color'], 'hex')
123
115
  end
124
116
  pdf.fill_color fill
125
117
  pdf.stroke_color border
data/lib/obf/utils.rb CHANGED
@@ -118,6 +118,15 @@ module OBF::Utils
118
118
  'sounds' => []
119
119
  }
120
120
  end
121
+
122
+ def self.fix_color(str, type='hex')
123
+ lookup = str + "::" + type
124
+ @@colors ||= {}
125
+ return @@colors[lookup] if @@colors[lookup]
126
+ color = `node lib/tinycolor_convert.js "#{str}" #{type}`.strip
127
+ @@colors[lookup] = color
128
+ color
129
+ end
121
130
 
122
131
  def self.parse_obf(obj)
123
132
  json = obj
@@ -966,4 +966,8 @@ else {
966
966
 
967
967
 
968
968
  var color = tiny(process.argv[2]);
969
- console.log(color.toHex());
969
+ if(process.argv[3] == 'rgb') {
970
+ console.log(color.toRgbString());
971
+ } else {
972
+ console.log(color.toHexg());
973
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json