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

Comments

Projects
None yet
2 participants
@tsdh
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

This comment has been minimized.

Show comment
Hide comment
@tsdh

tsdh Oct 30, 2015

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Oct 30, 2015

Owner

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?

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

This comment has been minimized.

Show comment
Hide comment
@tsdh

tsdh Oct 30, 2015

Contributor

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

Contributor

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 abo-abo closed this in 183b803 Oct 30, 2015

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Oct 30, 2015

Owner

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:)

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

This comment has been minimized.

Show comment
Hide comment
@tsdh

tsdh Oct 30, 2015

Contributor

👍

Contributor

tsdh commented Oct 30, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment