예제 #1
0
 def set_color(self, color, alpha=None, family=True):
     rgb = color_to_int_rgb(color)
     self.pixel_array[:, :, :3] = rgb
     if alpha is not None:
         self.pixel_array[:, :, 3] = int(255 * alpha)
     for submob in self.submobjects:
         submob.set_color(color, alpha, family)
     self.color = color
     return self
예제 #2
0
 def set_color(self, color, alpha=None, family=True):
     rgb = color_to_int_rgb(color)
     self.pixel_array[:, :, :3] = rgb
     if alpha is not None:
         self.pixel_array[:, :, 3] = int(255 * alpha)
     for submob in self.submobjects:
         submob.set_color(color, alpha, family)
     self.color = color
     return self
예제 #3
0
 def color_to_label(color: ManimColor) -> int:
     rgb_tuple = color_to_int_rgb(color)
     rgb = LabelledString.rgb_to_int(rgb_tuple)
     return rgb - 1
예제 #4
0
 def color_to_label(color: ManimColor) -> int:
     r, g, b = color_to_int_rgb(color)
     rg = r * 256 + g
     return rg * 256 + b