We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e69cd5c commit 6200869Copy full SHA for 6200869
backtesting/_plotting.py
@@ -2,13 +2,15 @@
2
import re
3
import sys
4
import warnings
5
+from colorsys import hls_to_rgb, rgb_to_hls
6
from itertools import cycle, combinations
7
from functools import partial
8
from typing import Callable, List, Union
9
10
import numpy as np
11
import pandas as pd
12
13
+from bokeh.colors import RGB
14
from bokeh.colors.named import (
15
lime as BULL_COLOR,
16
tomato as BEAR_COLOR
@@ -81,9 +83,10 @@ def colorgen():
81
83
82
84
85
def lightness(color, lightness=.94):
- color = color.to_hsl()
- color.l = lightness # noqa
86
- return color.to_rgb()
+ rgb = np.array([color.r, color.g, color.b]) / 255
87
+ h, _, s = rgb_to_hls(*rgb)
88
+ rgb = np.array(hls_to_rgb(h, lightness, s)) * 255
89
+ return RGB(*rgb)
90
91
92
_MAX_CANDLES = 10_000
0 commit comments