python-chess icon indicating copy to clipboard operation
python-chess copied to clipboard

feat: support rendering coordinates inside chessboard

Open plutotree opened this issue 8 months ago • 0 comments

Render coordinates inside the chessboard, left and bottom chess.svg.board(board, inside_coordinates=True)

r1

Render coordinates inside the chessboard, right and bottom chess.svg.board(board, inside_coordinates=True, inside_coord_style=2)

r2

chess.com board simulation

colors = {
    'square light': '#EBECD0',
    'square dark': '#739552',
}
chess.svg.board(board, inside_coordinates=True, colors=colors)

r3

The following params are added for svg.board function:

  • inside_coordinates: Pass True to enable render coordinates inside the board, this will override external coordinates if set to True. Default is False.
  • inside_coord_color_light: Color for coordinates on light squares, default is to use dark square color.
  • inside_coord_color_dark: Color for coordinates on dark squares, default is to use light square color.
  • inside_coord_style: 1 for style1 (default), 2 for style2.
    • Style 1:
      • The files labels are rendered in the bottom-right corner of each square in the bottom row of the chessboard.
      • The ranks labels are rendered in the top-left corner of each squares in the left column of the chess board.
    • Style 2:
      • The files labels are rendered in the bottom-left corner of each square in the bottom row of the chessboard.
      • The ranks labels are rendered in the top-right corner of each squares in the left column of the chess board.

close #1145

plutotree avatar Apr 18 '25 15:04 plutotree