lichess-org / chessground

Mobile/Web chess UI for lichess.org
https://lichess.org
GNU General Public License v3.0
1.01k stars 258 forks source link

Add option to show the (just-) captured piece on the chess board #298

Open hb20007 opened 3 months ago

hb20007 commented 3 months ago

Recently, an image of a chess position was shared on Chess Stack Exchange where the captured piece was shown on the board in a useful and interesting way, which led to many people wondering about what software was used to create it.

image

In the end, it seems that the image was simply edited for this effect, but it would be great to add this feature to chessground as a toggleable display setting.

It might be challenging to find the right CSS that would work with all piece sets, and there might also be difficulties in implementing this for edge squares. However, this feature is useful for remembering what piece was captured, and also taking screenshots of positions to quickly share on forums or social media is fairly common.

hjonasson commented 2 months ago

I like this idea. I wrote up a small change to demo it. On my branch it looks like this

image

I use the highlight.custom API to get it to work. @schlawg or any other maintainers, if I spend a few hours on polishing my branch would you consider merging it? I would make it an opt-in feature and not a default.