Reputation:
I am new come to emacs, but now got some problems, i cant set color of flycheck-posframe , what is correct way to set it.i had try write this but it cant work. thanks
(setq flycheck-posframe-warning-prefix "😅"
flycheck-posframe-error-prefix "😡"
flycheck-posframe-border-width 5
flycheck-posframe-error-face '((t :inherit nil :foreground "red"))
flycheck-posframe-warning-face `(:foreground-color ."orange")
flycheck-posframe-info-face '((t (:foreground "blue")))
flycheck-posframe-border-face '(:foreground "#dc752f")))
Upvotes: 2
Views: 402
Reputation: 680
Faces in Emacs are actually stored differently than normal variables are, which means that you can't set their values using setq
.
The easiest way to modify face attributes is through the Emacs Customization interface. You can do so by running the command M-x customize-face
and then entering in the name of the face you want to change. You can easily edit attributes of the face in this customization buffer. Once you finish making changes, you must either select Apply
(if you want the changes to apply for the current Emacs session) or Apply and Save
(if you want the changes to persist to future Emacs sessions as well) to have the changes occur.
Here's an example of using the customization buffer to modify flycheck-posframe-error-face
:
If for some reason you need to modify the face attributes using Emacs Lisp, however, you can do so using the set-face-attribute
function. This function takes the name of the face (as a symbol), a frame (the value of nil
means the change affects all frames), and alternating attribute names and values. Note that these attribute changes will only affect the current Emacs session. You would need to execute these functions each time you start an Emacs session for these changes to apply to that session (e.g. by adding the following commands to your init file).
The following should make the modifications you were attempting to make:
(set-face-attribute 'flycheck-posframe-error-face
nil
:inherit nil
:foreground "red")
(set-face-attribute 'flycheck-posframe-warning-face
nil
:foreground "orange")
(set-face-attribute 'flycheck-posframe-info-face
nil
:foreground "blue")
(set-face-attribute 'flycheck-posframe-border-face
nil
:foreground "#dc752f")
Upvotes: 2