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

counsel.el: Fix and improve counsel-colors-* #1436

Closed
wants to merge 1 commit into from

Conversation

@basil-conto
Copy link
Collaborator

commented Feb 7, 2018

Changelog

(counsel-colors--best-contrast-color)
(counsel-colors--update-highlight): Replace with shr-color-visible.
(counsel-colors--name-to-hex): Fix docstring.
(counsel-colors--formatter): New defun generalising ivy--format-function-generic for counsel-colors-emacs and counsel-colors-web and fixing foreground/background contrast of current candidate.
(counsel-colors-emacs, counsel-colors-web): Simplify logic. Fix docstring. Reduce display width. Do not hard-code ivy-count-format. Use counsel-colors--formatter with text properties.
(counsel-colors--web-colors-alist): Remove.
(counsel-colors--web-alist): Replacement for counsel-colors--web-colors-alist based on shr-color-html-colors-alist.
(counsel-colors-action-insert-hex, counsel-colors-action-kill-hex): Use text properties.
(counsel-colors-action-insert-name)
(counsel-colors-action-kill-name): Redundant; remove.

Justification and demonstration

Graphical terminal

Before

graphical-before

After

graphical-after

Text terminal

Before

tty-before

After

tty-after

Discussion

I haven't tested this, but in theory this should fix #921.

A further benefit of the refactor is that M-p within a counsel-colors-* session gives the colour name, rather than the unwieldy formatted name + hex + sample string.

Pinging @joedicastro for comment.

@basil-conto basil-conto force-pushed the basil-conto:blc/colour branch Feb 7, 2018

counsel.el: Fix and improve counsel-colors-*
(counsel-colors--best-contrast-color)
(counsel-colors--update-highlight): Replace with shr-color-visible.
(counsel-colors--name-to-hex): Fix docstring.
(counsel-colors--formatter): New defun generalizing
ivy--format-function-generic for counsel-colors-emacs and
counsel-colors-web and fixing foreground/background contrast of
current candidate.
(counsel-colors-emacs, counsel-colors-web): Simplify logic.  Fix
docstring.  Do not hard-code ivy-count-format.  Reduce display
width.  Use counsel-colors--formatter with text properties.
(counsel-colors--web-colors-alist): Remove.
(counsel-colors--web-alist): Replacement for
counsel-colors--web-colors-alist based on
shr-color-html-colors-alist.
(counsel-colors-action-insert-hex, counsel-colors-action-kill-hex):
Use text properties.
(counsel-colors-action-insert-name)
(counsel-colors-action-kill-name): Redundant; remove.

Fixes #921 and closes #1436.

@basil-conto basil-conto force-pushed the basil-conto:blc/colour branch to 6977d12 Feb 7, 2018

@abo-abo abo-abo closed this in 8f670ae Feb 7, 2018

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Feb 7, 2018

Looks good, thanks.

@basil-conto basil-conto deleted the basil-conto:blc/colour branch Feb 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.