11 points · by andrewljohnson · 17y ago · 8 comments
How can I set up some colors for important Django template tags?
If you can give me a bit of example code, that would be great. A link to an example of this would be great too.
Choose one of the included themes that you like the most, and start customizing.
Personally, I like zenburn. http://www.brockman.se/software/zenburn/zenburn.el But that might be a bit heavy to start off with.
Or, the shortcut way, define some stuff in custom-set-faces. e.g.:
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(paren-face-match-light ((t (:background "#5f5f5f" :foreground "#e37170" :weight ultra-bold))))
'(paren-face-match ((t (:background "#5f5f5f" :foreground "#e37170" :weight ultra-bold))))
'(paren-face-mismatch ((((class color)) (:background "#332323" :foreground "#e37170"))))
'(paren-face-no-match ((((class color)) (:background "#332323" :foreground "#e37170"))))
'(linum ((t (:foreground "#5f5f5f")))))
Of course, this all requires that your Django/Python mode has a face for the {% ... %} stuff. I've never done any Django work, so I'm not sure if it does. If it doesn't, you'll have to hack at the Django/Python mode some to define that face so you can color it.I got this snippet, and I think I can take it from here:
(defun django-highlight-comments ()
(interactive "p")
(highlight-regexp "{%.*?%}" 'hi-orange))
(add-hook 'html-mode-hook 'django-highlight-comments)is my preference
To change the color of a specific face in emacs, go to the face and do M-x set-face-foreground Return and put the color you want.