diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-05-17 11:47:33 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-05-17 11:47:33 +0000 |
| commit | b77d727eb4a822d3ee70b6c5e0949e76e6def5ea (patch) | |
| tree | 737e93b172a6e1c76109e35f9e555d5adc22f931 | |
| parent | c9f05ca3c0abf3b25b1a00caca72630ba6eb017e (diff) | |
| download | puzzles-b77d727eb4a822d3ee70b6c5e0949e76e6def5ea.zip puzzles-b77d727eb4a822d3ee70b6c5e0949e76e6def5ea.tar.gz puzzles-b77d727eb4a822d3ee70b6c5e0949e76e6def5ea.tar.bz2 puzzles-b77d727eb4a822d3ee70b6c5e0949e76e6def5ea.tar.xz | |
Just for Gareth: a means of overriding individual game colour
settings using environment variables. GTK frontend only, because
this is an unsupported (and unprincipled) hack.
[originally from svn r5792]
| -rw-r--r-- | gtk.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -1131,9 +1131,24 @@ static frontend *new_window(char *game_id, char **error) fe->ncolours = ncolours; fe->colours = snewn(ncolours, GdkColor); for (i = 0; i < ncolours; i++) { - fe->colours[i].red = colours[i*3] * 0xFFFF; - fe->colours[i].green = colours[i*3+1] * 0xFFFF; - fe->colours[i].blue = colours[i*3+2] * 0xFFFF; + /* + * Just for Gareth: if you dislike any of the standard + * colours, here's your chance to configure them in a + * really hacky way. + */ + char buf[80], *e; + unsigned int r, g, b; + sprintf(buf, "PUZZLE_COLOUR_%d", i); + if ((e = getenv(buf)) != NULL && + sscanf(e, "%2x%2x%2x", &r, &g, &b) == 3) { + fe->colours[i].red = r * 0x101; + fe->colours[i].green = g * 0x101; + fe->colours[i].blue = b * 0x101; + } else { + fe->colours[i].red = colours[i*3] * 0xFFFF; + fe->colours[i].green = colours[i*3+1] * 0xFFFF; + fe->colours[i].blue = colours[i*3+2] * 0xFFFF; + } } success = snewn(ncolours, gboolean); gdk_colormap_alloc_colors(fe->colmap, fe->colours, ncolours, |