Suggestion: add another set of stones with customisable color

Sometimes I enjoy playing one color go. To do this I have to use the customizable stones and set them to the same color.
Every time I do this I lose the colors I normally play with.
It’s not a big problem because I can save the color codes I prefer to play with, but I think adding another set would be a good idea if it is not too difficult to implement :slight_smile:
Alternatively, the arrow could return to the previously used colors (instead of simply black/white)

5 Likes

I think a related feature request would be to enable customizations specific to individual games. Basically, in addition to the global customization settings, allow each game to be individually customized with a theme that overrides the global choice. This would allow one to manage one-color go games in parallel with other games, or even sort games by type (like ladder, tournament, fast, slow, etc.) with different board themes.

5 Likes

@Feijoa and @GreenAsJade did some work a while back to have per-game board themes via a browser extension.

I don’t know if this included stone color, but it’s possible that can be built on to include stone themes too. The only thing that makes me think it wouldn’t be so easy is that stones are drawn on a canvas, so there might not be an element to attach custom css to…

4 Likes

I had vaguely remembered someone writing a script to replace the stones but I never looked into it :slight_smile:

4 Likes

Yes, the stones are drawn on the board’s canvas element using Javascript. That’s why I made a Tampermonkey script instead of just custom CSS, they “monkey patch” the draw stone code:

GoThemes.white.Plain.prototype.placeWhiteStone = placeStoneFn(white);
GoThemes.black.Plain.prototype.placeBlackStone = placeStoneFn(black);

I’m going to try to adapt Adam’s work for custom boards and make a proper pull request for custom stones… Adam also suggested easy buttons for one color go and blind go, I’ll see what I can do

6 Likes

I kind of misunderstood the OP and instead got side tracked looking at custom stones again… felt bad for hijacking the thread (going to move that discussion to another thread), so I put together a script for one color mode, grab it here. It needs a user script plugin, I use Tampermonkey

The way it works is it looks at the game’s name, if the name includes “one color” any where (capitalization shouldn’t matter) then it will turn on one color mode. There is also a way to override using game IDs, just open the script and add the ID you want to the list:

    // for games without "one color" in the name. put the game ID (from URL) in this list, don't forget the comma
    var OVERRIDE = [
        123,
        456,
    ];

It should turn itself off as soon as you switch to any other page or another game, and should turn itself off after the game finishes. There is a brief flash of two color mode the first time you load a game page*

Obviously, just a quick hack so might be bugs… but lmk if anyone uses it! Two color mode is hard enough for me so I will not test it much :joy:

*anyone know how to get extract the game name from page DOM or Javascript? without making an extra call to OGS API?

2 Likes

I think sometimes the game name is in the title. Also the game name is in the Javascript but I have no idea what tampermonkey can access.

But I think goban.title is one way to reach it on the Game page:

EDIT: not goban.title. it’s goban.config.game_name

Screen Shot 2022-01-08 at 1.29.21 PM

the window title? for me it’s always something like “black to move” or eventually “game finished”…

basically anything accessible from Javascript top level/global, or extract data from the DOM.

isn’t this state internal to some React component? I’m no front end expert, so I’m not sure how to get it that from outside

Yeah it is! I wasn’t sure what all you could do. I wonder if window['global_goban'] helps you out though!

The “Black to play” is a setting that can be turned off in favor of the game name I believe

1 Like

actually I was mistaken, you cannot just access window.global_goban for instance from a user script, there is some sandboxing going on to prevent malicious stuff. it’s a bit weird that you can monkey patch methods to replace them though :thinking:

2 Likes