Nazghul: text colorization in next release
I added colored text support to CVS recently, and produced this monstrosity here. Kaypy has suggested some improvements here. (Caveat: those links won't be up forever). He certainly has the better eye for color design than I do.
Meanwhile I'm trying to figure out a nice clean way to make the colorization consistent (whatever the colors turn out to be) throughout the UI. Naturally, I want to do it without tearing up a bunch of code. An obvious approach is to assign types to different UI elements that keep showing up: labels, dice roll strings, proper names, stats, etc, and then use an API to print them that automatically assigns the right color in the printing process.
This does not seem appealing:
That would entail a lot of rewriting. I'm thinking of adding a formatting layer instead:
Except I don't want to type all that, so I'd probably shorten it to:
Where the '/' character works like '%' in printf, indicating that a formatting code is about to come next. This is exactly the way I did colorization in the first place, and so far I haven't hated it.
Meanwhile I'm trying to figure out a nice clean way to make the colorization consistent (whatever the colors turn out to be) throughout the UI. Naturally, I want to do it without tearing up a bunch of code. An obvious approach is to assign types to different UI elements that keep showing up: labels, dice roll strings, proper names, stats, etc, and then use an API to print them that automatically assigns the right color in the printing process.
This does not seem appealing:
status_print_label("STR:");
status_print_stat(ch->getStrength());
That would entail a lot of rewriting. I'm thinking of adding a formatting layer instead:
status_print("%d ", ch->getStrength());
Except I don't want to type all that, so I'd probably shorten it to:
status_print("/lSTR /s%d", ch->getStrength());
Where the '/' character works like '%' in printf, indicating that a formatting code is about to come next. This is exactly the way I did colorization in the first place, and so far I haven't hated it.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home