manim-chess 0.0.32__tar.gz → 0.0.34__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. {manim_chess-0.0.32 → manim_chess-0.0.34}/PKG-INFO +2 -2
  2. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/board.py +17 -18
  3. {manim_chess-0.0.32 → manim_chess-0.0.34}/pyproject.toml +2 -2
  4. {manim_chess-0.0.32 → manim_chess-0.0.34}/LICENSE.txt +0 -0
  5. {manim_chess-0.0.32 → manim_chess-0.0.34}/README.md +0 -0
  6. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/__init__.py +0 -0
  7. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/evaluation_bar.py +0 -0
  8. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/game_player.py +0 -0
  9. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/bB.svg +0 -0
  10. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/bK.svg +0 -0
  11. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/bN.svg +0 -0
  12. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/bP.svg +0 -0
  13. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/bQ.svg +0 -0
  14. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/bR.svg +0 -0
  15. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/wB.svg +0 -0
  16. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/wK.svg +0 -0
  17. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/wN.svg +0 -0
  18. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/wP.svg +0 -0
  19. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/wQ.svg +0 -0
  20. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/piece_svgs/wR.svg +0 -0
  21. {manim_chess-0.0.32 → manim_chess-0.0.34}/manim_chess/pieces.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: manim-chess
3
- Version: 0.0.32
4
- Summary:
3
+ Version: 0.0.34
4
+ Summary: A plugin for animating chessboards. Includes additional features such as PGN conversion, arrows, etc.
5
5
  Author: swoyer2
6
6
  Author-email: swoyer.logan@gmail.com
7
7
  Requires-Python: >=3.12
@@ -21,6 +21,10 @@ class Board(Mobject):
21
21
  A list of coordinates of squares that are currently highlighted.
22
22
  arrows : list
23
23
  A list of arrow objects currently drawn on the board.
24
+ color_dark : ManimColor
25
+ The manim color of the dark squares
26
+ color_light : ManimColor
27
+ The manim color of the light squares
24
28
 
25
29
  Methods:
26
30
  -------
@@ -66,11 +70,15 @@ class Board(Mobject):
66
70
  Returns the piece at a given coordinate, if any.
67
71
  """
68
72
 
69
- def __init__(self) -> None:
73
+ def __init__(self, color_dark='#769656', color_light='#eeeed2', color_highlight_light='#F7F769', color_highlight_dark='#BBCB2B') -> None:
70
74
  """
71
75
  Initializes the Board object.
72
76
  """
73
77
  super().__init__()
78
+ self.color_dark = ManimColor(color_dark)
79
+ self.color_light = ManimColor(color_light)
80
+ self.color_highlight_light = ManimColor(color_highlight_light)
81
+ self.color_highlight_dark = ManimColor(color_highlight_dark)
74
82
  self.size_of_board = 8
75
83
  self.cell_size = 0.8 # Size of each square in the board
76
84
  self.squares = {} # squares[coordinate] = square
@@ -90,8 +98,8 @@ class Board(Mobject):
90
98
 
91
99
  for row in range(self.size_of_board):
92
100
  for col in range(self.size_of_board):
93
- CHESS_GREEN = ManimColor('#769656')
94
- CHESS_WHITE = ManimColor('#eeeed2')
101
+ CHESS_GREEN = self.color_dark
102
+ CHESS_WHITE = self.color_light
95
103
  color = CHESS_WHITE if (row + col) % 2 else CHESS_GREEN
96
104
  # Create a square for each cell in the board
97
105
  square = Square(side_length=self.cell_size)
@@ -123,12 +131,9 @@ class Board(Mobject):
123
131
  number : str
124
132
  The number to be displayed on the square.
125
133
  """
126
- CHESS_GREEN = ManimColor('#769656')
127
- CHESS_WHITE = ManimColor('#eeeed2')
128
-
129
134
  offset = np.array([self.cell_size / 8, -self.cell_size / 6, 0])
130
135
 
131
- number_color = CHESS_WHITE if square.fill_color == CHESS_GREEN else CHESS_GREEN
136
+ number_color = self.color_light if square.fill_color == self.color_dark else self.color_dark
132
137
  number = Text(f'{number}', color=number_color, font_size=14 * self.cell_size, font="Arial")
133
138
  square_top_left = square.get_center() + np.array([-self.cell_size / 2, self.cell_size / 2, 0])
134
139
  number.move_to(square_top_left + offset)
@@ -145,12 +150,10 @@ class Board(Mobject):
145
150
  letter : str
146
151
  The letter to be displayed on the square.
147
152
  """
148
- CHESS_GREEN = ManimColor('#769656')
149
- CHESS_WHITE = ManimColor('#eeeed2')
150
153
 
151
154
  offset = np.array([-self.cell_size / 8, self.cell_size / 6, 0])
152
155
 
153
- letter_color = CHESS_WHITE if square.fill_color == CHESS_GREEN else CHESS_GREEN
156
+ letter_color = self.color_light if square.fill_color == self.color_dark else self.color_dark
154
157
  letter = Text(f'{letter}', color=letter_color, font_size=14 * self.cell_size, font="Arial")
155
158
  square_bot_right = square.get_center() + np.array([self.cell_size / 2, -self.cell_size / 2, 0])
156
159
  letter.move_to(square_bot_right + offset)
@@ -326,13 +329,11 @@ class Board(Mobject):
326
329
  coordinate : str
327
330
  The coordinate of the square to be unmarked.
328
331
  """
329
- CHESS_GREEN = ManimColor('#769656')
330
- CHESS_WHITE = ManimColor('#eeeed2')
331
332
 
332
333
  if self.is_light_square(coordinate):
333
- self.squares[coordinate].set_fill(CHESS_WHITE)
334
+ self.squares[coordinate].set_fill(self.color_light)
334
335
  else:
335
- self.squares[coordinate].set_fill(CHESS_GREEN)
336
+ self.squares[coordinate].set_fill(self.color_dark)
336
337
 
337
338
  # Add back text on square if needed
338
339
  if coordinate[1] == '1':
@@ -349,13 +350,11 @@ class Board(Mobject):
349
350
  coordinate : str
350
351
  The coordinate of the square to be highlighted.
351
352
  """
352
- LIGHT_HIGHLIGHT_COLOR = ManimColor('#F7F769')
353
- DARK_HIGHLIGHT_COLOR = ManimColor('#BBCB2B')
354
353
 
355
354
  if self.is_light_square(coordinate):
356
- self.squares[coordinate].set_fill(LIGHT_HIGHLIGHT_COLOR)
355
+ self.squares[coordinate].set_fill(self.color_highlight_light)
357
356
  else:
358
- self.squares[coordinate].set_fill(DARK_HIGHLIGHT_COLOR)
357
+ self.squares[coordinate].set_fill(self.color_highlight_dark)
359
358
 
360
359
  # Add back text on square if needed
361
360
  if coordinate[1] == '1':
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "manim-chess"
3
- version = "0.0.32"
4
- description = ""
3
+ version = "0.0.34"
4
+ description = "A plugin for animating chessboards. Includes additional features such as PGN conversion, arrows, etc."
5
5
  authors = [
6
6
  {name = "swoyer2",email = "swoyer.logan@gmail.com"}
7
7
  ]
File without changes
File without changes