From c7c97335975b99d1eca6f5236c7e154015fd6889 Mon Sep 17 00:00:00 2001 From: Murat Saglam Date: Tue, 6 Aug 2024 13:01:10 +0100 Subject: [PATCH 1/2] roudning error in RGB functionality --- backtesting/_plotting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backtesting/_plotting.py b/backtesting/_plotting.py index 844318aa..ccc2c767 100644 --- a/backtesting/_plotting.py +++ b/backtesting/_plotting.py @@ -88,7 +88,8 @@ def colorgen(): def lightness(color, lightness=.94): rgb = np.array([color.r, color.g, color.b]) / 255 h, _, s = rgb_to_hls(*rgb) - rgb = np.array(hls_to_rgb(h, lightness, s)) * 255. + rgb = np.array(hls_to_rgb(h, lightness, s)) * 255 + rgb = np.rint(rgb) return RGB(*rgb) From b2acde61ad719cbbf4c7ad1ba99f6201fca03898 Mon Sep 17 00:00:00 2001 From: kernc Date: Wed, 22 Jan 2025 05:39:36 +0100 Subject: [PATCH 2/2] Update backtesting/_plotting.py --- backtesting/_plotting.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backtesting/_plotting.py b/backtesting/_plotting.py index ccc2c767..4b93b4be 100644 --- a/backtesting/_plotting.py +++ b/backtesting/_plotting.py @@ -88,8 +88,7 @@ def colorgen(): def lightness(color, lightness=.94): rgb = np.array([color.r, color.g, color.b]) / 255 h, _, s = rgb_to_hls(*rgb) - rgb = np.array(hls_to_rgb(h, lightness, s)) * 255 - rgb = np.rint(rgb) + rgb = (np.array(hls_to_rgb(h, lightness, s)) * 255).astype(int) return RGB(*rgb)