`garglk_set_zcolors` vs. `glk_style_measure`

garglk_set_zcolors is documented here: https://curiousdannii.github.io/if/gargoyle.html

One question that isn’t discussed there is what glk_style_measure() should return when you’re setting colors using garglk_set_zcolors().

I believe Spatterlight and Gargoyle currently disagree about how to implement glk_style_measure for TextColor and BackColor.

I’m inclined to say that Spatterlight’s way is best, because I see no other way to detect whether garglk_set_zcolors had an effect. For example, it might not have had an effect if the user has disabled author-defined colors with the stylehint 0 setting in garglk.ini. (Despite the name, stylehint also applies to zcolors.)

But maybe Gargoyle’s way is best. garglk_set_zcolors sets the color of spans of text; I’d expect that it’d ordinarily be used for overriding the normal text color. If you want to know what the “normal text color” currently is, Spatterlight has no way of telling you that.

Maybe there ought to be some (new?!) specific function to detect whether garglk_set_zcolors actually worked…?

My gut is that it should measure only the stylehint, not any overridden styles.

1 Like

That’s what I’d recommend.

glk_style_measure is for checking attributes of a specified style. The zcolors are an attribute of the stream.

If glk_style_measure always returns the zcolors when they’re active, then it isn’t possible to check the colors of any style without turning zcolors off. But there’s no way to test whether zcolors are currently active, so you can’t turn them off temporarily to check a style and then restore the previous state.

Adding a function like garglk_get_zcolors would make it possible to know when zcolors are active, and the game could decide for itself whether to care about them.

1 Like

As far as I can remember, this Spatterlight behaviour was never intentional. Any way, it is changed now to be identical to Gargoyle’s.

2 Likes