jdtsmith / indent-bars

Fast, configurable indentation guide-bars for Emacs
GNU General Public License v3.0
272 stars 7 forks source link

Set only `:blend` in `indent-bars-highlight-current-depth` #12

Closed aciceri closed 11 months ago

aciceri commented 11 months ago

Hey, great package! Finally one that has everything I always wanted.

I was wondering, is it possible to change only the blend factor for indent-bars-highlight-current-depth? There is written that

At least one of :color, :face, :width, :pad, :pattern, or :zigzag must be set and non-nil for this setting to take effect.

My indent-bars-color-by-depth is '(:regexp "outline-\\([0-9]+\\)" :blend 0.2) Currently I set indent-bars-highlight-current-depth to '(:face default :blend 0.4), my goal is that colors remain the same but the the current depth highlight had a greater blend factor, instead now it uses the default face (with a greater blend factor).

I'm on the terminal if this is relevant somehow.

jdtsmith commented 11 months ago

At present, the :blend in highlight-current-depth is for blending the specified current-depth color into the underlying color, not into the background color. I've just added a special case for when :blend is passed without any color or face; in that case it does what you are hoping for (I think) — re-blending the original main or depth-based colors with the BG, using the standalone blend as an override blend factor. Please give a try and report back.

aciceri commented 11 months ago

How fast! I've tried but nothing to do :( This is how I configured it:

(use-package indent-bars
  :custom
  (indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.2))
  (indent-bars-highlight-current-depth '(:blend 0.4))
  (indent-bars-no-stipple-char (string-to-char "┋")))

I'm on Emacs 29.1 (emacsclient in terminal). With this configuration the current depth "indent bar" doesn't show any difference compared to other ones:

image

Instead doing as before I get this:

(use-package indent-bars
  :custom
  (indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.2))
  (indent-bars-highlight-current-depth '(:face default :blend 0.4))
  (indent-bars-no-stipple-char (string-to-char "┋")))

image

nicolasavru commented 11 months ago

I wanted this feature also and it works fine for me with:

(setq indent-bars-color '(highlight :face-bg t :blend 0.5))
(setq indent-bars-highlight-current-depth '(:blend 1.0))
aciceri commented 11 months ago

Thanks @nicolasavru! With this now it works:

(use-package indent-bars
  :custom
  (indent-bars-color '(highlight :face-bg t :blend 0.2))
  (indent-bars-highlight-current-depth '(:blend 0.4))
  (indent-bars-no-stipple-char (string-to-char "┋")))

But if I also set indent-bars-color-by-depth to '(:regexp "outline-\\([0-9]+\\)" :blend 0.2) it stops showing bars. @jdtsmith On my side this can be closed now.

jdtsmith commented 11 months ago

Yes there are multiple blends and you have to read their docs carefully to understand the usage, since there are multiple effects (blend with frame background, blend with main color).

As you found, you need to set the main color's :blend differently from the standalone blend in highlight-current-depth ; formerly you had them the same. BTW, if you set indent-bars-color-by-depth :blend=0.2, the colors are very faint. The highlight still works, you can just barely see it. You need a 24bit color terminal too btw.