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

different colors for different highlights #25

Closed
c02y opened this issue Nov 17, 2014 · 4 comments
Closed

different colors for different highlights #25

c02y opened this issue Nov 17, 2014 · 4 comments

Comments

@c02y
Copy link

c02y commented Nov 17, 2014

The default highlight color of Prefix is green, the color of string defined in guide-key/highlight-command-regexp and guide-key/add-local-highlight-command-regexp are all yellow, can I specific a color for a specific string??

For example, I got

(setq guide-key/highlight-command-regexp "rectangle\\|register\\|helm\\|projectile")

and:

(add-hook 'c-mode-common-hook
      (lambda ()
        (guide-key/add-local-highlight-command-regexp "cscope")
        (guide-key/add-local-highlight-command-regexp "ggtags")
        ))

How can I make helm-related and projectile-related functions be highlighted in different colors?

BTW, what is the meaning of \\ in "rectangle\\|register\\|helm\\|projectile"?

@c02y c02y changed the title different colors for different highlight different colors for different highlights Nov 17, 2014
@kai2nenobu
Copy link
Owner

You can specify a face of a regexp in guide-key/highlight-command-regexp as below.

(setq guide-key/highlight-command-regexp
      '(("^helm-" . warning)
        ("^projectile-" . error)))

Choose your favorite face instead of warning or error.

If mode specific setting, use guide-key/add-local-highlight-command-regexp.

(add-hook 'c-mode-common-hook
      (lambda ()
        (guide-key/add-local-highlight-command-regexp '("^helm-" . warning))
        (guide-key/add-local-highlight-command-regexp '("^projectile-" . error))
        ))

I'm sorry but this feature is not documented in README.org.
I'll add the documentation ASAP.

@kai2nenobu
Copy link
Owner

The meaning of \\| in "rectangle\\|register\\|helm\\|projectile" is the OR operator of regular expression.

The OR operator of Emacs Lisp regular expression is \| and \ need to escape in Emacs Lisp string. See http://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Backslash.html#Regexp-Backslash in detail.

@c02y
Copy link
Author

c02y commented Nov 30, 2014

Besides warning and error faces you mentioned, there are several more faces at Basic_faces page, although they are enough, is is possible to set the colors like white, red, yellow??

@kai2nenobu
Copy link
Owner

I've implemented this feature. Try it from MELPA or github.

Please specify your favorite color name as string.

(setq guide-key/highlight-command-regexp
      '(("^helm-" . "sky blue")
        ("^projectile-" . "hot pink")))

You can get available color names by list-colors-display.

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