svg_profiler 2.0.0 → 2.0.1

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: 403478f11dec0b9d0c87c8446fc723c0b40014a2
4
- data.tar.gz: 60c06392446473c358969008666e971377493260
3
+ metadata.gz: d14d28e4b6dfb85ca74c0830690346e42c5d0d59
4
+ data.tar.gz: ddc47dcfeaec26771a2e1a94980ddcfb01bef60e
5
5
  SHA512:
6
- metadata.gz: 6d18996cd7623910260042b1238d98119c0b7a01637b10fdefee528fb36add99263d96d674e7ac9710bc121f22588a2e69d71b46bcc8bdcf260896863419c97d
7
- data.tar.gz: 1fe9346efa9380632229012c407079c36e991222c1893575982519d0516c641ef06352b2b6b48d0a3f493df9fad60e57fe7c6a7be3500df59c18199c2f4ead74
6
+ metadata.gz: 571244e824d4583ba6e0265528b6b502b13976eb6db75985cb961aa58bf2cf37a16f09b676c486c7ec29ad22d87fbcf8bc5e02f0798796629a76bc72fbbe19c3
7
+ data.tar.gz: 81e04e5bef20e769809fc9cc9ac215317fcfa7d6d8025c131da690f03e3c26565f0aa8be54a86730dcc5cd94712fd9ce1f4812575d4c7941ad8affcde83113b4
@@ -47,7 +47,7 @@ class SVGProfiler::Histogram
47
47
  pre_filter = normalize(hash)
48
48
 
49
49
  hash.reject! do |k, v|
50
- if !hex_codes.include?(k.downcase)
50
+ unless hex_codes.include?(k.downcase) || black?(k)
51
51
  warn_if_filtering_a_prominent_color(k, pre_filter)
52
52
  true
53
53
  end
@@ -62,6 +62,12 @@ class SVGProfiler::Histogram
62
62
  end
63
63
  end
64
64
 
65
+ # In cases where nodes do not explicitly set a color, they will be black.
66
+ # Therefore, do not filter out black from the histogram.
67
+ def black?(hex)
68
+ hex == "#000000"
69
+ end
70
+
65
71
  def normalize(frequencies)
66
72
  sum = frequencies.values.inject(:+)
67
73
  frequencies.inject({}) do |hash, (k, v)|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svg_profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Patuzzo