Skip to content

Commit

Permalink
Fix restore YELLOW (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucmos authored Mar 10, 2024
1 parent 9108a85 commit f63c6c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/powermanim/layouts/switchpalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

class SwitchPalette:
def __init__(self):
self.config = config
self.ORIGINAL_BLACK = deepcopy(Colors.BLACK)
self.ORIGINAL_GRAY_E = deepcopy(Colors.GRAY_E)
self.ORIGINAL_GREY_E = deepcopy(Colors.GREY_E)
Expand Down Expand Up @@ -76,6 +75,8 @@ def __init__(self):
self.ORIGINAL_DARK_BROWN = deepcopy(Colors.DARK_BROWN)
self.ORIGINAL_LIGHT_BROWN = deepcopy(Colors.LIGHT_BROWN)

self.ORIGINAL_YELLOW = deepcopy(Colors.YELLOW)

def switch_to_white_palette(self) -> SwitchPalette:
"""Switch to white palette.
Expand Down Expand Up @@ -166,12 +167,14 @@ def switch_to_white_palette(self) -> SwitchPalette:
Colors.PINK._internal_value = self.ORIGINAL_LIGHT_PINK._internal_value
Colors.LIGHT_PINK._internal_value = self.ORIGINAL_PINK._internal_value

# Fix the yellow color
Colors.YELLOW._internal_value = ManimColor._internal_from_hex_string("F8DB5F", alpha=1)
Colors.YELLOW_C._internal_value = ManimColor._internal_from_hex_string("F8DB5F", alpha=1)
return self

def restore_palette(self) -> SwitchPalette:
"""Switch to the original manim palette."""
# Restore the original palette
Colors.WHITE._internal_value = self.ORIGINAL_WHITE._internal_value
Colors.GRAY_A._internal_value = self.ORIGINAL_GRAY_A._internal_value
Colors.GREY_A._internal_value = self.ORIGINAL_GREY_A._internal_value
Expand Down Expand Up @@ -250,6 +253,9 @@ def restore_palette(self) -> SwitchPalette:
Colors.PINK._internal_value = self.ORIGINAL_PINK._internal_value
Colors.LIGHT_PINK._internal_value = self.ORIGINAL_LIGHT_PINK._internal_value

# Restore the yellow color
Colors.YELLOW._internal_value = self.ORIGINAL_YELLOW._internal_value

config.background_color = Colors.BLACK

return self

0 comments on commit f63c6c4

Please sign in to comment.