You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# is_dark Ruby Gem
2
2
Ruby Gem to detect a dark color over an area from a blob of a file or by a color hex code based on [luminance w3 standarts](https://www.w3.org/TR/WCAG20/#relativeluminancedef"luminance w3 standarts")
@@ -14,7 +14,7 @@ An example practical aspect: it can be useful to understand will a black colored
14
14
#### How to Install:
15
15
16
16
Gemfile:
17
-
`gem 'is_dark', '~> 0.1.7'`
17
+
`gem 'is_dark', '~> 0.1.9'`
18
18
19
19
Install:
20
20
`gem install is_dark`
@@ -35,19 +35,21 @@ Install:
35
35
5. is Imagick area from a blob dark (by coordinates of a dot + width and height from the dot):
36
36
`IsDark.magick_area_from_blob(x, y, blob, height, width)` #standart default settings
37
37
38
-
#### More examples:
39
-
It also has kind of a development mode, when you can generate a debug outputs of all the generated dots based on provided coordinates. It can draw a test area over the file if you want, so you always can be sure, that you have valid coordinates on your tests.
40
-
-`IsDark.set_debug_data(true, false)` #with debug info outputs in logs
41
-
42
-
-`IsDark.set_debug_data(true, '/var/www/project/is_dark_debug_output.pdf')` #with a generated debug pdf file (has displayed area of the analytics). You can use other file formats for the info (jpg, png, gif)
43
-
44
-
-`IsDark.magick_area_from_blob(x, y, blob, height, width)` #standart default settings
45
-
46
-
-` IsDark.magick_area_from_blob(x, y, blob, cf_height, cf_width, 60, (1..10))` #additional settings (percent of dark dots amount to mark an area as a dark, range of matrix to build dots 1..10 - means 10x10; 0..10 - will have 121 dots for the analytics)
47
-
48
-
Sometimes Imagick can't detect a pixel or it has no color, so it detects it as (RGB: 0,0,0), the gem has an option to consider pixels like this as "white", but if you need to disable this option add true or false at the end of the method:
49
-
50
-
-` IsDark.magick_area_from_blob(x, y, blob, cf_height, cf_width, 60, (1..10), false)` #detection "as white" is disabled)
38
+
#### Settings:
39
+
It also has kind of a development mode, when you can generate a debug outputs of all the generated dots based on provided coordinates. It can draw a test area over the file if you want, so you always can be sure, that you have valid coordinates on your tests. You can also set some other values and calibrate results as you need.
40
+
41
+
```ruby
42
+
IsDark.configure({
43
+
percent:70, #percent of dark dots under an area to mark all the area as dark
44
+
matrix: (0..10), #range of dots to analyse. (0..10) means matrix 10x10 or 100 dots to analyse
45
+
with_not_detected_as_white:true, # Sometimes Imagick can't detect a pixel or it has no color, so it detects it as (RGB: 0,0,0), the gem has an option to consider pixels like this as "white", but if you need to disable this option add true or false
46
+
with_debug:true, #show debug output
47
+
with_debug_file:true, #draw a tested area in a copy of your blob file
48
+
debug_file_path: debug_file_path #path of the file with a drawn area
49
+
})
50
+
```
51
+
You can use these settings and test it after with this command:
52
+
`IsDark.magick_area_from_blob(x, y, blob, height, width)`, so it will show a debug info with a generated file
0 commit comments