thisisparker / cursewords

:pencil: Terminal-based crossword puzzle solving interface
GNU Affero General Public License v3.0
248 stars 28 forks source link

Need to replace term.dim() to upgrade blessed dependency #34

Closed thisisparker closed 3 years ago

thisisparker commented 3 years ago

In a few places, cursewords uses term.dim() for sections that don't need consistent user focus... stuff like the title, and the lines of the grid. The result looks great, imo, and you can see it here and compare the regular brightness reversed message with the dimmed version: image

I especially like it because, to date, I haven't added customizable color support... instead it just uses the colors of your terminal, and that dim-to-regular relationship is preserved even with different color palettes, without me having to force a particular scheme: image

BUT in my long-overdue review of a @jquast PR I've learned term.dim() is not very widely supported, and its use has been partially deprecated in new version of blessed (which I want to use!). So I have two questions to explore:

jquast commented 3 years ago

Suggest bright_black or color_rgb which will map to the nearest 16 or 256-color

thisisparker commented 3 years ago

@jquast ah, that's sort of what I feared. There's no way to specify a "less bright" version of the user's default color in an agnostic way, then? (e.g. bright_black is a great grey for a black-on-white terminal, but not as much for green-on-black, and it was nice to leave that selection up to the user for as long as I could.)

thisisparker commented 3 years ago

Or to the second point, is there any way in blessed I could identify the user's current defaults? I could probably fudge a dim version of that myself, if I knew what it were...

thisisparker commented 3 years ago

I think I might have found a short-term solution: it appears I can use, e.g.,

echo(term.dim + "this is dim text" + term.normal)
# instead of
echo(term.dim("this is dim text"))

and it will continue to work for at least blessed 1.18.1. In the meantime, I'll have to build in better color stuff on my end!

thisisparker commented 3 years ago

Closing this issue because the above workaround made it into b0c1ec2bf07ec91975519b04c662582be37152df, although the real fix will be when I have custom color support and the dim color is explicitly specified.