Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiper/ivy: Make background blending optional #278

Closed
tsdh opened this issue Oct 30, 2015 · 5 comments
Closed

swiper/ivy: Make background blending optional #278

tsdh opened this issue Oct 30, 2015 · 5 comments

Comments

@tsdh
Copy link
Contributor

tsdh commented Oct 30, 2015

Right now, swiper and ivy blend the background colors of the different match groups with the background color defined for the current selection. With that blending, the background colors I have defined for the groups are hardly recognizable at all:

screenshot from 2015-10-30 09-36-16

Would it be possible to make that blending optional so that the match group backgrounds are always taken literally?

Of course, that has one problem. When you have many equal candidates and your input matches the complete candidates, then you can't know what's the currently selected one. In that case, you should define ivy-current-match so that it differs from the match group faces in something else than just background, e.g., have it underlined.

@tsdh
Copy link
Contributor Author

tsdh commented Oct 30, 2015

Or alternatively, the blending could just be improved. Maybe it just doesn't work nicely for dark backgrounds right now...

@abo-abo
Copy link
Owner

abo-abo commented Oct 30, 2015

When you have many equal candidates and your input matches the complete candidates, then you can't know what's the currently selected one.

Exactly, that's an issue I kept running into, until I added blending. Also keep in mind that a program is free to pass propertized strings with custom backgrounds to ivy-read, e.g. like lispy-goto or moo-jump-local does.

Or alternatively, the blending could just be improved. Maybe it just doesn't work nicely for dark backgrounds right now...

This is the direction to go, I think. Which specific theme do you have in mind?

In any case, do try (setq colir-compose-method 'colir-compose-soft-light). I think it works pretty well for dark themes.

Then it's just a matter to patch colir-blend to conditionally use 'colir-compose-soft-light when the current theme is dark:

(defun colir-blend (c1 c2)
  "Blend the two colors C1 and C2 using `colir-compose-method'.
C1 and C2 are triples of floats in [0.0 1.0] range."
  (apply #'color-rgb-to-hex
         (cl-mapcar
          colir-compose-method
          c1 c2)))

Do you know how to make current-theme-dark-p predicate?

@tsdh
Copy link
Contributor Author

tsdh commented Oct 30, 2015

Oleh Krehel notifications@github.com writes:

Or alternatively, the blending could just be improved. Maybe it just
doesn't work nicely for dark backgrounds right now...

This is the direction to go, I think. Which specific theme do you have
in mind?

My tsdh-dark-theme.el which ships with emacs. But I think the problem
is there with any reasonably dark theme.

In any case, do try (setq colir-compose-method 'colir-compose-soft-light). I think it works pretty well for dark
themes.

Oh, yes, that works!

Then it's just a matter to patch colir-blend to conditionally use
'colir-compose-soft-light when the current theme is dark:

(defun colir-blend (c1 c2)
  "Blend the two colors C1 and C2 using `colir-compose-method'.
C1 and C2 are triples of floats in [0.0 1.0] range."
  (apply #'color-rgb-to-hex
         (cl-mapcar
          colir-compose-method
          c1 c2)))

Do you know how to make current-theme-dark-p predicate?

Yes.

(frame-parameter nil 'background-mode)
;=> dark

The value is either the symbol dark or the symbol light.

,----[ (info "(elisp)Font and Color Parameters") ]
| ‘background-mode’
| This parameter is either ‘dark’ or ‘light’, according to whether
| the background color is a light one or a dark one.
`----

Bye,
Tassilo

@abo-abo
Copy link
Owner

abo-abo commented Oct 30, 2015

Thanks. I've made the change to use 'colir-compose-soft-light for dark themes. Looks nice in tango-dark, misterioso, flatland etc. Except looks weird in tsdh-dark, with your recent update. But that's up to you:)

@tsdh
Copy link
Contributor Author

tsdh commented Oct 30, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants