|
16 | 16 | "random_bright_color", |
17 | 17 | "random_color", |
18 | 18 | "get_shaded_rgb", |
| 19 | + "DARK_BLUE", |
| 20 | + "DARK_BROWN", |
| 21 | + "LIGHT_BROWN", |
| 22 | + "BLUE_E", |
| 23 | + "BLUE_D", |
| 24 | + "BLUE_C", |
| 25 | + "BLUE_B", |
| 26 | + "BLUE_A", |
| 27 | + "TEAL_E", |
| 28 | + "TEAL_D", |
| 29 | + "TEAL_C", |
| 30 | + "TEAL_B", |
| 31 | + "TEAL_A", |
| 32 | + "GREEN_E", |
| 33 | + "GREEN_D", |
| 34 | + "GREEN_C", |
| 35 | + "GREEN_B", |
| 36 | + "GREEN_A", |
| 37 | + "YELLOW_E", |
| 38 | + "YELLOW_D", |
| 39 | + "YELLOW_C", |
| 40 | + "YELLOW_B", |
| 41 | + "YELLOW_A", |
| 42 | + "GOLD_E", |
| 43 | + "GOLD_D", |
| 44 | + "GOLD_C", |
| 45 | + "GOLD_B", |
| 46 | + "GOLD_A", |
| 47 | + "RED_E", |
| 48 | + "RED_D", |
| 49 | + "RED_C", |
| 50 | + "RED_B", |
| 51 | + "RED_A", |
| 52 | + "MAROON_E", |
| 53 | + "MAROON_D", |
| 54 | + "MAROON_C", |
| 55 | + "MAROON_B", |
| 56 | + "MAROON_A", |
| 57 | + "PURPLE_E", |
| 58 | + "PURPLE_D", |
| 59 | + "PURPLE_C", |
| 60 | + "PURPLE_B", |
| 61 | + "PURPLE_A", |
| 62 | + "WHITE", |
| 63 | + "BLACK", |
| 64 | + "LIGHT_GRAY", |
| 65 | + "LIGHT_GREY", |
| 66 | + "GRAY", |
| 67 | + "GREY", |
| 68 | + "DARK_GREY", |
| 69 | + "DARK_GRAY", |
| 70 | + "DARKER_GREY", |
| 71 | + "DARKER_GRAY", |
| 72 | + "GREY_BROWN", |
| 73 | + "PINK", |
| 74 | + "LIGHT_PINK", |
| 75 | + "GREEN_SCREEN", |
| 76 | + "ORANGE", |
19 | 77 | ] |
20 | 78 |
|
21 | | - |
| 79 | +from enum import Enum |
22 | 80 | import random |
23 | 81 |
|
24 | 82 | from colour import Color |
25 | 83 | import numpy as np |
26 | 84 |
|
27 | 85 | from ..constants import COLOR_MAP |
28 | | -from ..constants import WHITE |
29 | 86 | from ..utils.bezier import interpolate |
30 | 87 | from ..utils.simple_functions import clip_in_place |
31 | 88 | from ..utils.space_ops import normalize |
32 | 89 |
|
33 | 90 |
|
| 91 | +class Colors(Enum): |
| 92 | + """A list of pre-defined colors. |
| 93 | + Examples |
| 94 | + -------- |
| 95 | + The preferred way of using these colors is |
| 96 | + .. code-block:: python |
| 97 | + import manim.utils.color as C |
| 98 | + C.WHITE # -> '#FFFFFF' |
| 99 | + Note this way uses the name of the colors below in UPPERCASE. |
| 100 | + Alternatively, you can also import this Enum directly and use its members |
| 101 | + directly, through the use of :code:`color.value`. Note this way uses the |
| 102 | + name of the colors in lowercase. |
| 103 | + .. code-block:: python |
| 104 | + from manim.utils.color import Colors |
| 105 | + Colors.white.value # -> '#FFFFFF' |
| 106 | + """ |
| 107 | + |
| 108 | + dark_blue = "#236B8E" |
| 109 | + dark_brown = "#8B4513" |
| 110 | + light_brown = "#CD853F" |
| 111 | + blue_e = "#1C758A" |
| 112 | + blue_d = "#29ABCA" |
| 113 | + blue_c = "#58C4DD" |
| 114 | + blue = "#58C4DD" |
| 115 | + blue_b = "#9CDCEB" |
| 116 | + blue_a = "#C7E9F1" |
| 117 | + teal_e = "#49A88F" |
| 118 | + teal_d = "#55C1A7" |
| 119 | + teal_c = "#5CD0B3" |
| 120 | + teal = "#5CD0B3" |
| 121 | + teal_b = "#76DDC0" |
| 122 | + teal_a = "#ACEAD7" |
| 123 | + green_e = "#699C52" |
| 124 | + green_d = "#77B05D" |
| 125 | + green_c = "#83C167" |
| 126 | + green = "#83C167" |
| 127 | + green_b = "#A6CF8C" |
| 128 | + green_a = "#C9E2AE" |
| 129 | + yellow_e = "#E8C11C" |
| 130 | + yellow_d = "#F4D345" |
| 131 | + yellow_c = "#FFFF00" |
| 132 | + yellow = "#FFFF00" |
| 133 | + yellow_b = "#FFEA94" |
| 134 | + yellow_a = "#FFF1B6" |
| 135 | + gold_e = "#C78D46" |
| 136 | + gold_d = "#E1A158" |
| 137 | + gold_c = "#F0AC5F" |
| 138 | + gold = "#F0AC5F" |
| 139 | + gold_b = "#F9B775" |
| 140 | + gold_a = "#F7C797" |
| 141 | + red_e = "#CF5044" |
| 142 | + red_d = "#E65A4C" |
| 143 | + red_c = "#FC6255" |
| 144 | + red = "#FC6255" |
| 145 | + red_b = "#FF8080" |
| 146 | + red_a = "#F7A1A3" |
| 147 | + maroon_e = "#94424F" |
| 148 | + maroon_d = "#A24D61" |
| 149 | + maroon_c = "#C55F73" |
| 150 | + maroon = "#C55F73" |
| 151 | + maroon_b = "#EC92AB" |
| 152 | + maroon_a = "#ECABC1" |
| 153 | + purple_e = "#644172" |
| 154 | + purple_d = "#715582" |
| 155 | + purple_c = "#9A72AC" |
| 156 | + purple = "#9A72AC" |
| 157 | + purple_b = "#B189C6" |
| 158 | + purple_a = "#CAA3E8" |
| 159 | + white = "#FFFFFF" |
| 160 | + black = "#000000" |
| 161 | + light_gray = "#BBBBBB" |
| 162 | + light_grey = "#BBBBBB" |
| 163 | + gray = "#888888" |
| 164 | + grey = "#888888" |
| 165 | + dark_grey = "#444444" |
| 166 | + dark_gray = "#444444" |
| 167 | + darker_grey = "#222222" |
| 168 | + darker_gray = "#222222" |
| 169 | + grey_brown = "#736357" |
| 170 | + pink = "#D147BD" |
| 171 | + light_pink = "#DC75CD" |
| 172 | + green_screen = "#00FF00" |
| 173 | + orange = "#FF862F" |
| 174 | + |
| 175 | + |
| 176 | +DARK_BLUE = Colors.dark_blue.value |
| 177 | +DARK_BROWN = Colors.dark_brown.value |
| 178 | +LIGHT_BROWN = Colors.dark_brown.value |
| 179 | +BLUE_E = Colors.blue_e.value |
| 180 | +BLUE_D = Colors.blue_d.value |
| 181 | +BLUE_C = Colors.blue_c.value |
| 182 | +BLUE_B = Colors.blue_b.value |
| 183 | +BLUE_A = Colors.blue_a.value |
| 184 | +TEAL_E = Colors.teal_e.value |
| 185 | +TEAL_D = Colors.teal_d.value |
| 186 | +TEAL_C = Colors.teal_c.value |
| 187 | +TEAL_B = Colors.teal_b.value |
| 188 | +TEAL_A = Colors.teal_a.value |
| 189 | +GREEN_E = Colors.green_e.value |
| 190 | +GREEN_D = Colors.green_d.value |
| 191 | +GREEN_C = Colors.green_c.value |
| 192 | +GREEN_B = Colors.green_b.value |
| 193 | +GREEN_A = Colors.green_a.value |
| 194 | +YELLOW_E = Colors.yellow_e.value |
| 195 | +YELLOW_D = Colors.yellow_d.value |
| 196 | +YELLOW_C = Colors.yellow_c.value |
| 197 | +YELLOW_B = Colors.yellow_b.value |
| 198 | +YELLOW_A = Colors.yellow_a.value |
| 199 | +GOLD_E = Colors.gold_e.value |
| 200 | +GOLD_D = Colors.gold_d.value |
| 201 | +GOLD_C = Colors.gold_c.value |
| 202 | +GOLD_B = Colors.gold_b.value |
| 203 | +GOLD_A = Colors.gold_a.value |
| 204 | +RED_E = Colors.red_e.value |
| 205 | +RED_D = Colors.red_d.value |
| 206 | +RED_C = Colors.red_c.value |
| 207 | +RED_B = Colors.red_b.value |
| 208 | +RED_A = Colors.red_a.value |
| 209 | +MAROON_E = Colors.maroon_e.value |
| 210 | +MAROON_D = Colors.maroon_d.value |
| 211 | +MAROON_C = Colors.maroon_c.value |
| 212 | +MAROON_B = Colors.maroon_b.value |
| 213 | +MAROON_A = Colors.maroon_a.value |
| 214 | +PURPLE_E = Colors.purple_e.value |
| 215 | +PURPLE_D = Colors.purple_d.value |
| 216 | +PURPLE_C = Colors.purple_c.value |
| 217 | +PURPLE_B = Colors.purple_b.value |
| 218 | +PURPLE_A = Colors.purple_a.value |
| 219 | +WHITE = Colors.white.value |
| 220 | +BLACK = Colors.black.value |
| 221 | +LIGHT_GRAY = Colors.light_gray.value |
| 222 | +LIGHT_GREY = Colors.light_grey.value |
| 223 | +GRAY = Colors.gray.value |
| 224 | +GREY = Colors.grey.value |
| 225 | +DARK_GREY = Colors.dark_grey.value |
| 226 | +DARK_GRAY = Colors.dark_gray.value |
| 227 | +DARKER_GREY = Colors.darker_gray.value |
| 228 | +DARKER_GRAY = Colors.darker_gray.value |
| 229 | +GREY_BROWN = Colors.grey_brown.value |
| 230 | +PINK = Colors.pink.value |
| 231 | +LIGHT_PINK = Colors.light_pink.value |
| 232 | +GREEN_SCREEN = Colors.green_screen.value |
| 233 | +ORANGE = Colors.orange.value |
| 234 | + |
| 235 | + |
34 | 236 | def color_to_rgb(color): |
35 | 237 | if isinstance(color, str): |
36 | 238 | return hex_to_rgb(color) |
|
0 commit comments