From e045421e3700dd674c3486bb1bd1e31b08f3f257 Mon Sep 17 00:00:00 2001 From: Sergei Illarionov Date: Fri, 31 Jan 2025 00:03:19 +0300 Subject: [PATCH] debug mode update --- is_dark.gemspec | 2 +- lib/is_dark.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/is_dark.gemspec b/is_dark.gemspec index 3f7f78e..5650573 100644 --- a/is_dark.gemspec +++ b/is_dark.gemspec @@ -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 " \ diff --git a/lib/is_dark.rb b/lib/is_dark.rb index 137d8ea..f3921b0 100644 --- a/lib/is_dark.rb +++ b/lib/is_dark.rb @@ -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