Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change the piece theme after the board is created? #215

Open
frazereastman opened this issue Apr 13, 2021 · 1 comment
Open

How can I change the piece theme after the board is created? #215

frazereastman opened this issue Apr 13, 2021 · 1 comment

Comments

@frazereastman
Copy link

I am creating a chess opening trainer and want to know how I can change the piece theme after the board has been generated using the config settings?
Thank you in advance.

@hcgreier
Copy link

hcgreier commented Oct 22, 2022

Hi,

simply put the png files of your theme in a subfolder. They must be named bB.png, bK.png,...,wB.png, wK.png and so on.
Then trigger your board and set the correct folder path in the settings object.

let pieceSetup ....(some script to get the folder name)

let board = Chessboard('yourBoardID', {
  pieceTheme: `[path to your themes folder]/${pieceSetup}/{piece}.png`,
  // other settings...
});

Variable "pieceSetup" is the subfolder name with your png files of the pieces. As this is in a string literal you can change it with your script.

greets,
hc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants