about summary refs log tree commit diff
path: root/lib/paperclip/color_extractor.rb
diff options
context:
space:
mode:
authorShubhendra Singh Chauhan <withshubh@gmail.com>2021-02-01 01:56:09 +0530
committerGitHub <noreply@github.com>2021-01-31 21:26:09 +0100
commitc8d11b8bdb97a1a2f8aaf5deca5f1c6c7c0d2688 (patch)
tree3b3552d07969abc85bac41b1ac5ff7fb8e2573a7 /lib/paperclip/color_extractor.rb
parent3efa0c54b6656fba189baab0857e60c0bc4f3c7d (diff)
Fixed code quality issues (#15541)
* Added .deepsource.toml

* Removed bad use of `alias`

* Fixed operand order in the binary expression

* Prefixed unused method arguments with an underscore

* Replaced the old OpenSSL algorithmic constants with the newer strings initializers.

* Removed unnecessary UTF-8 encoding comment
Diffstat (limited to 'lib/paperclip/color_extractor.rb')
-rw-r--r--lib/paperclip/color_extractor.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/paperclip/color_extractor.rb b/lib/paperclip/color_extractor.rb
index a70a3d21f..d3b8e1022 100644
--- a/lib/paperclip/color_extractor.rb
+++ b/lib/paperclip/color_extractor.rb
@@ -55,7 +55,7 @@ module Paperclip
       # If we don't have enough colors for accent and foreground, generate
       # new ones by manipulating the background color
       (2 - foreground_colors.size).times do |i|
-        foreground_colors << lighten_or_darken(background_color, 35 + (15 * i))
+        foreground_colors << lighten_or_darken(background_color, 35 + (i * 15))
       end
 
       # We want the color with the highest contrast to background to be the foreground one,
@@ -147,7 +147,7 @@ module Paperclip
         g = l.to_f
         b = l.to_f # achromatic
       else
-        q = l < 0.5 ? l * (1 + s) : l + s - l * s
+        q = l < 0.5 ? l * (s + 1) : l + s - l * s
         p = 2 * l - q
         r = hue_to_rgb(p, q, h + 1 / 3.0)
         g = hue_to_rgb(p, q, h)