Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make tweaks to a color-theme per mode?

I'm using Emacs 23.2.1 from Ubuntu 11.04. I've installed purcell's port of the Solarized color-theme, but I'd like to adjust some of the faces to make my Python buffers look more like the Solarized Vim screenshot. It's easy enough to edit the color-theme so that my preferred colors are always used, but that would also change them in C mode and I want to avoid that.

Specifically, here's the default setting for the builtin-face:

(font-lock-builtin-face ((t (:foreground ,green))))

In Python mode - and only Python mode - I'd like to use this instead:

(font-lock-builtin-face ((t (:foreground ,blue))))

I'd ideally like to make this change by patching some logic into the color-theme definition so that I can send my adjustments upstream with a note saying "this changes just the Python highlighting". Failing that, I'd settle for something in my init.el. I'd much rather have it packaged with the main color-theme, though.

Is this possible? Scratch that. This is Emacs; I know it's possible! But how can I do it?

like image 498
Kirk Strauser Avatar asked Apr 08 '11 19:04

Kirk Strauser


People also ask

Can you change colors on WordPress themes?

There are many ways of changing the background color of a WordPress theme. Typically you will find the option to change your theme colors when you visit Appearance > Customize. You can also customize colors as per your need by including additional CSS using your theme settings or through a CSS plugin.

How do you change the theme Color in HTML?

Suppose that if we want our website to appear in green color along with changing the browser theme color which will be the same as our website, then we can use a meta tag with name and content attribute. Meta Tag: The <meta> tag is used in the <head> element of HTML Document.


1 Answers

This should be possible using Face Remapping. Even though you prefer to patch up the color-theme definition, I'd argue for putting something like the following lines into your init.el file, as it is a more "standard" way of doing such things:

(add-hook 'python-mode-hook 'remap-builtin-face-blue)

(defun remap-builtin-face-blue ()
  (let ((blue "#2075c7"))
    (set (make-local-variable 'face-remapping-alist)
         `((font-lock-builtin-face :foreground ,blue)))))
like image 134
Thomas Avatar answered Sep 24 '22 14:09

Thomas