chessboardjs
chessboardjs copied to clipboard
Change Piece color at runtime
It seems that the piece images are only loaded at startup through a config. Would it be possible to allow choosing the images at runtime and not just startup?
You can accomplish this by using a function for the piece theme configuration instead of a string. I did it like so:
getPiece(piece) {
return 'images/pieces/' + this.chosen_theme + '/' + piece + '.png'
}
Replace chosen_theme with whatever variable holds the pieces theme you want.
Then in your board config you set pieceTheme
to the getPiece
function.
Please close issue