Closed Luis-Henriquez-Perez closed 7 years ago
Do you just want to change the colors? If so, yeah, overwrite/customize the faces.
I've been meaning to have an example of colorschemes but I never got around to that...
Emacs can have multiple color themes enabled at once, so you could write up a theme and enable that alongside whatever other color theme you use.
I wrote the code below this. But it isn't working. I tried calling telephone-line-evil-config
before and after declaring the faces. I'm going to see if I can just use the customize
option.
(use-package telephone-line
:config
(progn
(telephone-line-evil-config)
(defface telephone-line-evil-insert
'((t (:foreground "white" :background "forest green" :inherit mode-line-inactive)))
:group 'telephone-line-evil)
(defface telephone-line-evil-normal
'((t (:foreground "white" :background "orange" :inherit mode-line-inactive)))
:group 'telephone-line-evil)
(defface telephone-line-evil-visual
'((t (:foreground "white" :background "pink" :inherit mode-line-inactive)))
:group 'telephone-line-evil)
(defface telephone-line-evil-motion
'((t (:foreground "white" :background "purple" :inherit mode-line-inactive)))
:group 'telephone-line-evil)
(defface telephone-line-evil-operator
'((t (:foreground "white" :background "red" :inherit mode-line-inactive)))
:group 'telephone-line-evil)))
Ah the customize option worked well thank you.
That won't work because you're redefining faces that already exist. Customize will work since it's changing the values defined in telephone-line.el
. If you want to make a theme, you can use custom-theme-set-faces
I went a while without a modeline then came back to telephone-line and revisited this issue.
I managed to change the face colors using customize-faces
. I think this is a better solution than custom-theme-set-faces
, because custom-theme-set-faces
requires an existing theme so that it can change the faces, so I'd have to create a whole theme to just change a few faces.
Anyway here is the code that solved the issue. It's important to note it must be used after (evil-mode 1)
has been called or it will complain about evil state cursors not being defined.
(custom-set-faces
`(telephone-line-evil-insert ((t (:foreground "black" :background ,(cadr evil-insert-state-cursor) :inherit telephone-line-evil))))
`(telephone-line-evil-normal ((t (:foreground "black" :background ,(cadr evil-normal-state-cursor) :inherit telephone-line-evil))))
`(telephone-line-evil-visual ((t (:foreground "black" :background ,(cadr evil-visual-state-cursor) :inherit telephone-line-evil))))
`(telephone-line-evil-replace ((t (:foreground "black" :background ,(cadr evil-replace-state-cursor) :inherit telephone-line-evil))))
`(telephone-line-evil-motion ((t (:foreground "black" :background ,(cadr evil-motion-state-cursor) :inherit telephone-line-evil))))
`(telephone-line-evil-operator ((t (:foreground "black" :background ,(cadr evil-operator-state-cursor) :inherit telephone-line-evil))))
`(telephone-line-evil-emacs ((t (:foreground "black" :background ,(cadr evil-emacs-state-cursor) :inherit telephone-line-evil)))))
Since this code is after I defined what colors and shapes I want for the evil-state cursors I just reference them with (cadr evil-statename-state-cursor)
and evaluate them using the tick mark. But replacing the cadr
statements with a static color and the tick mark with '
is fine too.
custom-theme-set-faces
doesn't require an existing theme, you can make a new one that only configures telephone-line
. You can enable multiple themes at the same time.
It would be really nice if your README / configuration file showed an example of customizing the colour themes. I also just want to change the evil state colours.
Yeah, I definitely want to have an example up on the repo.
How do change the default modal colors of evil telephone line faces? From reading the source code, it seems that
telephone-line-modal-face
is responsible for this returning the right face on modal changes. I'm not sure whether I need to overwrite thetelephone-line-modal-face
function to return the faces I want for mode or if I should overwrite the faces (telephone-line-evil-insert
,telephone-line-evil-normal
, etc.). I did look at the examples provided but I couldn't figure out a clear way to do this.