larstvei / Focus

Dim the font color of text in surrounding paragraphs
470 stars 14 forks source link

Being able to use own colorscheme, but little darkened? #2

Open ReneFroger opened 9 years ago

ReneFroger commented 9 years ago

Thanks for sharing this plugin, it's appreciated. It reminds me of LimeLight.

But I found it hard to read other syntax color when it's not lightened up, and navigate it every time to see the syntax highlighting.

Would it not be a great idea, to use the according colorscheme, but a little darkened (like 80% of opacitiy, while focus have 100% opacitiy), instead convert the non-focus text to one color?

larstvei commented 9 years ago

Hi!

This would be cool (and the thought has crossed my mind), but I'm not sure how to implement it. The current approach is to use a simple overlay in unfocused sections; this is simple and efficient. The color is determined by what color you foreground/background is, along with the focus-dimness customizable variable.

The only idea I have on how to do this would require to make an overlay for each character (worst case) in the buffer, and this does not seem like sound approach. If you (or someone else) have an idea on how to implement this efficiently I'd gladly try to implement it!

I was not familiar with LimeLight, looks like something Vim'ers would enjoy :+1:

Thanks for sharing your idea; I hope I'll be able to add it eventually!

xobzoo commented 4 years ago

I just discovered focus today (as I was reviewing the things recently added to melpa) and I like the idea behind it. Although I think it doesn't work as I would like in org-mode, it seems to be correct enough for programing modes.

However, as noted in this issue, I want to keep the coloration in the rest of my buffer, just faded. (although having an option to completely gray everything out is a nice idea) Anyway, I remembered just barely reading that dimmer claims to work the way we want:

This package provides a minor mode that indicates which buffer is currently active by dimming the faces in the other buffers. It does this nondestructively, and computes the dimmed faces dynamically such that your overall color scheme is shown in a muted form without requiring you to define what is a "dim" version of every face.

I haven't yet looked at implementation details of either one (dimmer and focus) to see how they're implemented, so maybe there isn't enough in common to make it easy. (I don't even really know how faces work.) But maybe it's the awesome breakthrough that makes everything easy?

larstvei commented 4 years ago

Thank you @xobzoo, I didn't know about dimmer! I haven't looked too closely at the implementation yet, but it shows that it's possible to achieve (and the code does not look scary at first glance). This leaves me with no excuse to not implement this, other than the general "I don't have time" excuses. So with any luck, this issue can be closed soon 🙂

larstvei commented 4 years ago

I'm glad to finally make some progress on this, five years after it was opened! Could anyone test #23?

Shooooooooo commented 4 years ago

Works for me in general. A bit laggy and temporary wrong color when scrolling. (P.S. I tested with TTY)