From f99c71bb71d05ccba10a99f04bdf8339118a4a70 Mon Sep 17 00:00:00 2001 From: Matthieu Durocher Date: Fri, 16 Jul 2021 21:23:35 +0000 Subject: [PATCH 1/3] Update color_HSL_adjust.py The Hue level has a range of 360. --- color_HSL_adjust.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/color_HSL_adjust.py b/color_HSL_adjust.py index 303b1f39..2496399e 100755 --- a/color_HSL_adjust.py +++ b/color_HSL_adjust.py @@ -17,9 +17,9 @@ class HslAdjust(inkex.ColorExtension): def modify_color(self, name, color): if self.options.random_hue: - color.hue = int(random.random() * 255.0) + color.hue = int(random.random() * 360.0) elif self.options.hue: - color.hue += (self.options.hue * 2.55) + color.hue += (self.options.hue) if self.options.random_saturation: color.saturation = int(random.random() * 255.0) -- GitLab From 24b4900b6b0f372c1b37ee675538f20afd110da8 Mon Sep 17 00:00:00 2001 From: Matthieu Durocher Date: Sat, 17 Jul 2021 15:46:02 +0000 Subject: [PATCH 2/3] Update color_HSL_adjust.py Hue uses 256 values internally and 360 values visually. --- color_HSL_adjust.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/color_HSL_adjust.py b/color_HSL_adjust.py index 2496399e..71c17862 100755 --- a/color_HSL_adjust.py +++ b/color_HSL_adjust.py @@ -17,9 +17,9 @@ class HslAdjust(inkex.ColorExtension): def modify_color(self, name, color): if self.options.random_hue: - color.hue = int(random.random() * 360.0) + color.hue = int(random.random() * 255.0) elif self.options.hue: - color.hue += (self.options.hue) + color.hue += (self.options.hue * 0.7111) if self.options.random_saturation: color.saturation = int(random.random() * 255.0) -- GitLab From 992f458c0309d528966d649b6a9f9f717f2c3b0f Mon Sep 17 00:00:00 2001 From: Jonathan Neuhauser Date: Wed, 19 Jan 2022 21:54:44 +0100 Subject: [PATCH 3/3] review comments --- color_HSL_adjust.py | 2 +- tests/test_color_HSL_adjust.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/color_HSL_adjust.py b/color_HSL_adjust.py index 71c17862..1425ba0d 100755 --- a/color_HSL_adjust.py +++ b/color_HSL_adjust.py @@ -19,7 +19,7 @@ class HslAdjust(inkex.ColorExtension): if self.options.random_hue: color.hue = int(random.random() * 255.0) elif self.options.hue: - color.hue += (self.options.hue * 0.7111) + color.hue += (self.options.hue * 256.0/360) if self.options.random_saturation: color.saturation = int(random.random() * 255.0) diff --git a/tests/test_color_HSL_adjust.py b/tests/test_color_HSL_adjust.py index bd0753df..5b01f408 100644 --- a/tests/test_color_HSL_adjust.py +++ b/tests/test_color_HSL_adjust.py @@ -9,11 +9,11 @@ class ColorHSLAdjustTest(ColorBaseCase): ((255, 255, 255), "#ffffff"), ((0, 0, 0), "#000000"), ((0, 128, 0), "#008000"), - ((91, 166, 176), "#5a74af", ['-x 10']), - ((91, 166, 176), "#745aaf", ['-x 320']), + ((91, 166, 176), "#5a98af", ['-x 10']), + ((91, 166, 176), "#5aaf80", ['-x 320']), ((91, 166, 176), "#5ba6b0", ['-x 0']), - ((91, 166, 176), "#af5a6c", ['-x 12345']), - ((91, 166, 176), "#5aacaf", ['-x -1']), + ((91, 166, 176), "#af5a78", ['-x 12345']), + ((91, 166, 176), "#5aa8af", ['-x -1']), ((91, 166, 176), "#4eafbb", ['-s 10']), ((91, 166, 176), "#0be5fe", ['-s 90']), ((91, 166, 176), "#5ba6b0", ['-s 0']), -- GitLab