insipx / kak-crosshairs

Highlight the current column/line when editing in Kakoune
The Unlicense
14 stars 4 forks source link

[Feature] Get default line color from colorscheme #10

Open FlyingWombat opened 5 years ago

FlyingWombat commented 5 years ago

This plugin is pretty great, but what would make it even better is if it could determine the default highlighter color from the current colorscheme's background color. The default dark-gray works well for most dark color schemes, but is a stark contrast on light schemes.

Idea 1

A simple solution might be to just set the line highlighter color equal to StatusLine, BufferPadding, or Prompt from the colorscheme.

Idea 2

Another, more complicated way, could be to set a "turn" point between light and dark, and base the highlighter color off the Default face color.
Then increment / decrement the RGB value from the colorscheme based on which side of the turn point it is.

For example:
Set "turn" as 0x44,
Then if background is rgb:222222, add 0x11 to each pair, to make it lighter.
If background is rgb:cccccc, subtract 0x11 from each pair, to make it darker.

IDK if it would be better to decide Add vs Sub for each pair in the RGB value, or do something like average them to do the same for all three pairs.

insipx commented 5 years ago

yeah, I've been thinking of this problem as of late too

I'll play around with some foreground/background colors and see if I can find anything that works for a majority of the colorschemes I have loaded into kak right now

FlyingWombat commented 5 years ago

I think, ideally, the line and column highlighters should just slightly increase the contrast between foreground and background. To do that, we need to know what colors the set color scheme is using, since it'll be different between light and dark schemes. But, AFAIK that isn't possible in Kakoune yet. See https://github.com/mawww/kakoune/issues/736

Or, maybe the solution to this could be to add a "Default High Contrast" face to all colorschemes, that is higher contrast than default, but still has syntax highlighting.