mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Update random_bright_color to operate based on hsl ranges
This commit is contained in:
parent
31b2bcd9e6
commit
e4c824e672
1 changed files with 10 additions and 3 deletions
|
@ -121,9 +121,16 @@ def random_color() -> Color:
|
||||||
return Color(rgb=tuple(np.random.random(3)))
|
return Color(rgb=tuple(np.random.random(3)))
|
||||||
|
|
||||||
|
|
||||||
def random_bright_color() -> Color:
|
def random_bright_color(
|
||||||
color = random_color()
|
hue_range: tuple[float, float] = (0.0, 1.0),
|
||||||
return average_color(color, Color(WHITE))
|
saturation_range: tuple[float, float] = (0.5, 0.8),
|
||||||
|
luminance_range: tuple[float, float] = (0.5, 1.0),
|
||||||
|
) -> Color:
|
||||||
|
return Color(hsl=(
|
||||||
|
interpolate(*hue_range, random.random()),
|
||||||
|
interpolate(*saturation_range, random.random()),
|
||||||
|
interpolate(*luminance_range, random.random()),
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
def get_colormap_list(
|
def get_colormap_list(
|
||||||
|
|
Loading…
Add table
Reference in a new issue