Can't get colors to show up in the mode-line.
(eval-after-load "projectile"
'(setq projectile-mode-line
'(:eval (concat " Pj["
(propertize (projectile-project-name)
'foreground "#81a2be")
"]"))))
The value gets evaluated correctly, because I see it change in the mode-line when I change pojectile projects, unfortunately it seems that string properties are stripped somewhere down the line. Any ideas how to fix this? Thx
EDIT projectile is unlikely to be at fault here cause I tried this with no effect:
(eval-after-load "lisp-mode"
'(defadvice emacs-lisp-mode
(after rename-modeline activate)
(setq mode-name
(propertize "El" 'foreground "#81a2be"))))
SOLUTION appears that I have been using the wrong property. Thanks to @politza this now works:
(eval-after-load "projectile"
'(setq projectile-mode-line
'(:eval (list " [Pj:"
(propertize (projectile-project-name)
'face '(:foreground "#81a2be"))
"]"))))
One caveat is that replacing (list ...)
with (concat ...)
to actually concatenate strings breaks things. If anyone knows why, I'd be glad to learn.
mode-line-format
(including, adding coloring): amitp.blogspot.com/2011/08/emacs-custom-mode-line.html Since theprojectile-mode-line
is essentially the value of the minor-mode:lighter
, you would likely need to customize themode-line-format
to achieve the coloring you desire -- i.e., attempting to add color to the value of a:lighter
is likely the problem in this case.One caveat is that replacing (list ...) with (concat ...) to actually concatenate strings breaks things. If anyone knows why, I'd be glad to learn.
I have observed the same thing. Usingconcat
to return a single string with text properties doesn't seem to work.