ianfab / fairyground

playground for Fairy-Stockfish in the browser
https://fairyground.vercel.app/
GNU General Public License v3.0
20 stars 5 forks source link

Cobalt board theme #44

Closed dpldgr closed 8 months ago

dpldgr commented 8 months ago

A new board theme with cobalt colouring and lower contrast to increase piece/letter visibility.

I have confirmed all the built in variants show the new boards.

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fairyground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 11:27am
ianfab commented 8 months ago

Thanks. Two questions:

dpldgr commented 8 months ago
  • How did you create the SVGs and the CSS? I like to avoid manually maintaining such repetitive things, so it would be good if it were reproducible as for the other boards in generate_css.sh.

I wrote a C++ program to generate all of it. I'm currently on a Windows machine and haven't setup access to a shell yet to develop and test out a .sh script. Once I've got that setup, it shouldn't be too hard to port it over as it's mostly text manipulation.

  • Is there a specific reason you added it as the new first board, or just personal preference? Since it is a bit more uncommon than the other boards I would place it later, at least after the common blue, green, and brown boards.

It was more incidental rather than intentional that I placed it first. No worries at all, I've just move the board priority in themes.txt.

Are you happy to commit what's done and I'll get around to updating the .sh script within the next week or two, or would you prefer to hold fire until that's completed?

dpldgr commented 8 months ago

@ianfab I've thought about this futher and had a bit of a play with generating boards on the fly with JavaScript. With about 100 lines of code, I've been able to generate an SVG and with a single function call in the console that can replace the current active board with one of user specified colors, for example:

makeNewBoard( "default", 8, 8, "#555555", "#AAAAAA" );

replaces the 8x8 board on the "default" theme with squares of light and dark grey.

Exactly how this could be integrated with the rest of the theme mechanism I'm not entirely sure just yet, but for relatively simple boards that are nothing more than squares of solid colours, it is bound to be more maintainable than potentially having thousands of board SVGs stored on the server. The current way of handling boards would still be required for more specialised boards such as those used for shogi and xiangqi.

ianfab commented 8 months ago

Thanks, I merged it as is for now. Having the same general base SVG for all basic two-colored boards would be preferable. Whether the generation happens at build or runtime I do not have a strong preference. Committing so many SVGs is a little bit ugly, but they are tiny anyways, like >1000x smaller than the WASM, so I am at least not too worried about storage or traffic related to them.