File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 22import re
33import sys
44import warnings
5+ from colorsys import hls_to_rgb, rgb_to_hls
56from itertools import cycle, combinations
67from functools import partial
78from typing import Callable, List, Union
89
910import numpy as np
1011import pandas as pd
1112
13+ from bokeh.colors import RGB
1214from bokeh.colors.named import (
1315 lime as BULL_COLOR,
1416 tomato as BEAR_COLOR
@@ -81,9 +83,10 @@ def colorgen():
8183
8284
8385def lightness(color, lightness=.94):
84- color = color.to_hsl()
85- color.l = lightness # noqa
86- return color.to_rgb()
86+ 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)
8790
8891
8992_MAX_CANDLES = 10_000
You canβt perform that action at this time.
0 commit comments