From 4e54c6de5462aba09faa9f12f959d7ef1e3d2d06 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 24 Nov 2020 13:29:27 -0800 Subject: [PATCH] Fix rgb_to_hex bug --- manimlib/utils/color.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manimlib/utils/color.py b/manimlib/utils/color.py index 91d97142..a362b128 100644 --- a/manimlib/utils/color.py +++ b/manimlib/utils/color.py @@ -35,7 +35,11 @@ def rgba_to_color(rgba): def rgb_to_hex(rgb): - return "#" + "".join(hex(int(255 * x))[2:] for x in rgb) + return "#" + "".join( + hex(int_x // 16)[2] + hex(int_x % 16)[2] + for x in rgb + for int_x in [int(255 * x)] + ) def hex_to_rgb(hex_code):