Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

[HELPER] Add a color helper function.

frozar8962eb134425
diff --git a/helpers.py b/helpers.py
index 58cfc7c8e..3efb62ab4 100644
--- a/helpers.py
+++ b/helpers.py
@@ -125,6 +125,9 @@ def rgb_to_color(rgb):
def rgba_to_color(rgba):
return rgb_to_color(rgba[:3])
+def rgb_to_hex(rgb):
+ return Color(rgb = rgb).get_hex_l()
+
def invert_color(color):
return rgb_to_color(1.0 - color_to_rgb(color))