cursewords icon indicating copy to clipboard operation
cursewords copied to clipboard

Use color for highlighted word

Open TablesawTablesawsen opened this issue 6 years ago • 2 comments

The underscores don't pop for me very well in my terminal (particularly when more of the grid has been filled in), so I'd like to be able to add color. Right now I have a fork with this code:

    def draw_highlighted_cell(self, position):
        value, markup = self.compile_cell(position)
        value = self.term.green_underline(value) + markup
        print(self.term.move(*self.to_term(position)) + value)

    def draw_cursor_cell(self, position):
        value, markup = self.compile_cell(position)
        value = self.term.green_reverse(value) + markup
        print(self.term.move(*self.to_term(position)) + value)

I'm not familiar with blessed, and I'm not sure if there's an elegant way to slot in a color (other than using getattr on a concatenated string).

TablesawTablesawsen avatar Mar 06 '19 19:03 TablesawTablesawsen

Oh this is interesting. I've mostly avoided specifying color because I'm not sure how to control the explicitly colored bits interacting with the "default" bits. How does your fork look?

This might be sort of laborious and is kind of a tangent, but I think at some point I should introduce a "color-specified" mode and then a fallback "b/w" mode. (That could also introduce "theme" support.)

thisisparker avatar Mar 06 '19 22:03 thisisparker

The only code changes for me have been adding 'green' in the code above. It looks like this: screenshot from 2019-03-06 15-13-54 It would make sense to have this respond to a flag, possibly talking a color argument.

TablesawTablesawsen avatar Mar 07 '19 08:03 TablesawTablesawsen