gonewest818 / dimmer.el

Interactively highlight which buffer is active by dimming the others.
GNU General Public License v3.0
267 stars 14 forks source link

Dim incorrect color in `js2-mode`. #21

Closed jcs090218 closed 4 years ago

jcs090218 commented 5 years ago

This is what happens when I use js2-mode. I'm not quite sure what is the issue here. Do you think is something you can do? All other mode look good except js2-mode.

Only the string color is incorrect the rest are fine...

dimmer-bug

gonewest818 commented 4 years ago

It seems possible this is a case of the "wrong color" issue described in the FAQ. So if this is still an issue for you, would you mind changing dimmer-use-colorspace as defined here in the code? Let me know how that goes.

gonewest818 commented 4 years ago

TL;DR - if you've set dimmer-use-colorspace to something other than :cielab please set it back to :cielab for now.


I've been looking into this a little more. I used a color picker to grab values out of your animated gif. It looks like that string constant is roughly #BF9983, and the bg is something close to #161416, which is very dark but tinted purple.

I suspect you're dimming in :hsv space? In that case your background color has a hue angle close to 300 degrees, and the foreground orange has a hue angle near 20 degrees. The dimmer code should be choosing the "shortest" path between those hue angles, which in this case is the clockwise direction from 300 degrees to 20 degrees passing through zero. However, I think the code is taking the "long" path which is counterclockwise from 300 degrees to 20 degrees, and that direction includes all the green hues. This is a bug I need to fix.

However in the meantime, you should be able to work around this by dimming in :cielab which is the default setting anyway. I double-checked the interpolation of this foreground and background color in CIELAB space and it looks fine to me.

There is a second bug, which is that dimmer-use-colorspace has a documentation string that offers three configuration choices: :cielab, :rgb, and :hsl. However, the color interpolation code is actually looking for :hsv instead of :hsl. I'll fix that too.