obf 0.9.8.10 → 0.9.8.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5887852bddf42b571fd8f7eb218c687bac537a033eced3e39b4337d1dab5649
4
- data.tar.gz: 8078156b8ff756c09a5d7b4fe6c2ed631bb8ba8bdc74a208d34eb462218cdb98
3
+ metadata.gz: 46ac08afef61672a59703da2bc305d08bf293cbbebbe98a1a0b53db0a9344e9d
4
+ data.tar.gz: 6234bb16ab6c89a021d0754ad759955a0cb6709a808dd7e357475b45156d3c4b
5
5
  SHA512:
6
- metadata.gz: d92677f8f0365ab972cb8ea060a0bd69b4541342022c6f5600693c3e368ca29c230ca217ba08d9ba0a73b613c029564bc07c4cbcfaf3cd9ef5071c94530ccd61
7
- data.tar.gz: b4fb1d7224de77acab7d80b6a7cdf707dbcad55d2e54f3e5ff78116e9dbd114259d40a640fbd8221addba0f88c80e6eb0ae3fb633ab8505324b753912f04e7a4
6
+ metadata.gz: 44c9c23805b78858c0018e818bedb6feebb1aebe2acef09518497595e83a3245ff7929de15734a5910a2f6b1458b9526652e38b7680847f5db738ff04fdadd08
7
+ data.tar.gz: 1fa32a4e2a6b7ee0a6a86caec469415e3b3552c5233117dc894673d9c1d41f63b8a03b24fd9a8ce5a2bfe2ea02b0aa5842d78bb322aba0b7dfbe856fd1aa4093
data/lib/obf/external.rb CHANGED
@@ -122,7 +122,7 @@ module OBF::External
122
122
  images.each do |img|
123
123
  if path_hash && path_hash['images'] && path_hash['images'][img['id']]
124
124
  elsif img['url'] && !img['data']
125
- got_url = OBF::Utils.get_url(img['url'], true)
125
+ got_url = OBF::Utils.get_url(img['url'].to_s, true)
126
126
  if got_url['request']
127
127
  hydra.queue(got_url['request'])
128
128
  grabs << {req: got_url['request'], img: img, res: got_url}
data/lib/obf/pdf.rb CHANGED
@@ -255,10 +255,11 @@ module OBF::PDF
255
255
  elsif options['text_case'] == 'lower'
256
256
  text = text.downcase
257
257
  end
258
+ text_color = OBF::Utils.fix_color(fill, 'contrast')
258
259
 
259
260
  if options['text_only']
260
261
  # render text
261
- pdf.fill_color "000000"
262
+ pdf.fill_color text_color
262
263
  pdf.text_box text, :at => [0, 0], :width => button_width, :height => button_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit, :direction => direction
263
264
  else
264
265
  # render image
@@ -285,7 +286,7 @@ module OBF::PDF
285
286
  pdf.fill_color "ffffff"
286
287
  pdf.stroke_color "eeeeee"
287
288
  pdf.fill_and_stroke_rounded_rectangle [button_width - 18, page_vertical], 20, text_height, 5
288
- pdf.fill_color "000000"
289
+ pdf.fill_color text_color
289
290
  text_options = {:text => page}
290
291
  text_options[:anchor] = "page#{page}" if options['links']
291
292
  pdf.formatted_text_box [text_options], :at => [button_width - 18, page_vertical], :width => 20, :height => text_height, :align => :center, :valign => :center
@@ -293,7 +294,7 @@ module OBF::PDF
293
294
  end
294
295
 
295
296
  # render text
296
- pdf.fill_color "000000"
297
+ pdf.fill_color text_color
297
298
  vertical = options['text_on_top'] ? button_height : text_height
298
299
  pdf.text_box text, :at => [0, vertical], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit, :direction => direction
299
300
  end
@@ -1120,6 +1120,8 @@ else {
1120
1120
  var color = tiny(process.argv[2]);
1121
1121
  if(process.argv[3] == 'rgb') {
1122
1122
  console.log(color.toRgbString());
1123
+ } else if(process.argv[3] == 'contrast') {
1124
+ console.log(tiny.mostReadable(color, ['#fff', '#000']).toHex());
1123
1125
  } else {
1124
1126
  if(color.getAlpha() < 1.0) {
1125
1127
  var rgb = color.toRgb();
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.9.8.10
4
+ version: 0.9.8.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2020-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json