Skip to content

Commit

Permalink
debug mode update
Browse files Browse the repository at this point in the history
  • Loading branch information
butteff committed Jan 30, 2025
1 parent 830c3db commit e045421
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion is_dark.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = 'is_dark'
s.version = '0.2.1'
s.version = '0.2.2'
s.summary = 'Detects a dark background under an area or by a color code'
s.description = 'Detects a dark color based on luminance W3 standarts ' \
"( https://www.w3.org/TR/WCAG20/#relativeluminancedef ). \n\n " \
Expand Down
6 changes: 4 additions & 2 deletions lib/is_dark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@ def magick_area_from_blob(x, y, blob, height, width)
end
dark = true if points >= (dots.length / 100) * @percent
if @with_debug
percent_calculated = points/(dots.length / 100)
p '=================================================================================='
p "Total Points: #{dots.length}, dark points amount:#{points}"
p "Is \"invert to white not detectd pixels\" option enabled?:#{@with_not_detected_as_white}"
p "Percent of dark dots in the matrix: #{@percent}%"
p "Percent of dark dots in the matrix: #{percent_calculated}%"
p "Percent to consider as a dark area from settings: #{@percent}%"
p "Luminance value is: #{@luminance}"
p "Is Area Dark?: #{dark}"
p "have a look on #{@debug_file_path} file to see your tested area of a blob"
p "have a look on #{@debug_file_path} file to see your tested area of a blob" if @with_debug_file
p '=================================================================================='
end
dark
Expand Down

0 comments on commit e045421

Please sign in to comment.