This page is for questions and answers about the color-theme package. For info on the package, see ColorTheme.
You can ask your question on the newly dedicated section at https://answers.launchpad.net/color-theme-el This tool will be used to build a clean FAQ for color-theme-el. I will try to compile a selection of the best questions/answers to be published here. – XavierMaillard
I have a function that toggles between two themes, taken from the EmacsWiki’s color-theme page:
(defun toggle-themes () "Switch to/from night color scheme." (interactive) (if (eq (frame-parameter (next-frame) 'background-mode) 'light) (color-theme-gnome2) (color-theme-snapshot)))
(I set the color-theme-snapshot just after initializing
‘color-theme’, and load gnome2 after that)
Now, when Emacs loads, it displays the gnome2 theme properly. Then, when I change to snapshot, everything’s fine. The problem is when I change it once again: the comments are blue, but the comment starting tags (// in C++, ;; in Lisp, whatever) are red (as in the snapshot theme). I’ve tried re-declaring
‘font-lock-comment-face’, but it’s not working. Any thoughts?
After applying a color theme, is there a way to undo that change – to get back all of the Frame, Face, etc. settings that were in effect before the change? I’m looking for a function that will do this (not “restart Emacs”). – DrewAdams
(require 'color-theme) (defun color-theme-undo () (interactive) (color-theme-reset-faces) (color-theme-snapshot)) ;; backup current color theme (fset 'color-theme-snapshot (color-theme-make-snapshot)) ;;change color theme ;;M-x color-theme-undo
maybe you need to modify faces.el file
738c738 < (when (stringp family) --- > (when (or (stringp family)(eq family 'unspecified)) 741c741 < (when (stringp foundry) --- > (when (or (stringp foundry)(eq foundry 'unspecified))
Once that random color theme function brings up a theme that I really like, how do I find out that theme’s name? – BryanMurdock
‘color-theme-history’. It is not maintained automatically. Set
‘color-theme-history-max-length’first. – AlexSchroeder
Is there a way to make a theme “dynamic”? Specifically, I want to have the font size scale up or down based on the screen resolution of the display (e.g. based on (cond ((= (x-display-pixel-width) 1280) … ). – GregFenton
Is there a way of overriding the MousePointer colors that seem to be set by the color theme?
I’ve seen this question posted elsewhere but could find no solutions. When I use color-theme with NTEmacs. Under certain themes, the cursor turns black. I tried using (set-cursor-color “red”) which works for like 1/2 seconds. The cursor promptly returns to black which his annoying because you can’t see the character under the cursor. Anyone figured out that problem? – FrancoisDenisGonthier
Yes. I reported that bug in May 2006. It has been fixed recently in Emacs 22. See the thread “cursor-color frame parameter cannot equal background-color” in
firstname.lastname@example.org. This has nothing to do, per se, with color themes, BTW. – DrewAdams
Recently I faced a quite similar problem with official v22.1 GNU Emacs. Finally I found that modifying cua-enable-cursor-indications to nil (in custom-set-variables in .emacs) solved the problem. I think this could be a bug in color-theme: probably it (=the color themes I tried) doesn’t (re)set faces used in cua-mode (assuming cua-mode has its own faces). If this is the case, then I would think it is color-theme’s fault.
Another similar problem: using Gnus with
‘color-theme-subtle-hacker’ the Newsgroups, Subject, X-Draft-From, From, etc. texts are unreadable: according to
‘describe-text-properties’ they are fontified with face
‘message-header-name’ whose Foreground should be DodgerBlue1 what is nicely readable, but I see them in dark green what is unreadable. If I
‘facemenu-remove-face-props’ them, then they become readable…
What could cause this gnus problem? – Peter Tury
Everything works fine, if I start with load-library color-theme in the input line. If I try to load from .emacs file I get an error:
Wrong type argument: keymapp, nil
setq: Symbol’s function definition is void: color-theme-filter
Same for me!!! Sob… Emilio Luque
The answer is simple, I made a change in the code (pretty small change btw) to make color-theme working with emacs-devel. To switch back this change, just change all occurences of easy-add-menu to have “tools” instead of “Tools”. That should do the trick. I have opened a bug report on Gna! (https://gna.org/bugs/?func=detailitem&item_id=5059).
Correction: This should be easy-menu-add, not easy-add-menu. There are two instances in 6.5.5 and changing “Tools” to “tools” makes color-theme work again. (Joachim.)
6.5.5 is Ok with xemacs 21.4.15, but 6.6.0 has two problems:
For (1), if your init.el looks like this:
(require 'color-theme) (color-theme-xemacs)
Then you need to change it to:
(require 'color-theme) (color-theme-initialize) (color-theme-xemacs)
For (2), you need to edit color-theme.el. Line 223 is:
"/themes") t "^color-theme")
Change this to:
"themes") t "^color-theme")
Maybe my logic unit is not up yet but this customization entry confuses me:
Color Theme Is Cumulative: Hide Value Toggle on (non-nil) State: STANDARD. Determines wether new color themes are installed on top of each other. Hide Rest If non-nil, installing a color theme will undo all settings made by previous color themes.
The other way arround would make more sense to me. – Andre Kuehne
I use emacs on both X and terminal, color-theme is great on X, but on terminal when there are only 8 colors, some theme makes emacs looks ugly and text becomes unreadable. I’m using emacsclient. How can I disable color-theme on a terminal frame? Any hooks I can use? – sylecn
Well, you could put something in your init file like this:
(when (display-graphic-p) (color-theme-whatever))
‘window-system’ if your Emacs version does not have function
You could use
‘if’ and use an alternative color scheme on console; some work pretty well.
The above solution optionally loads the theme system wide depending on the type of the first frame opened. When using emacsclient it is often the case that a user will have both tty and x frames open. Is there any way to optoinally “turn on” the current theme in only x frames? Using the old Color Themes package this was possible with code like the following. It does not appear to be possible using the new built in theme support in custom.el.
;; test for each frame or console (defun color-theme-for-win-sys (frame) (let ((color-theme-is-global nil)) (select-frame frame) (when (window-system frame) (color-theme-railscasts)))) ;; hook on after-make-frame-functions (add-hook 'after-make-frame-functions 'color-theme-for-win-sys) ;; Start up the color theme in this initial frame. (let ((color-theme-is-global nil)) (when (window-system) (color-theme-railscasts)))
It would be nice to have a list of color-themes that work well on a terminal.
Themes on a terminal instance of emacs that I like: Well one first has to enable colors. Put:
# colors! works in gnome-terminal and hopefully others as well # put this in your .bashrc file export TERM=xterm-256color
;; fav theme e.g. ;; (load-theme 'manoj-dark) ; nice ;; (load-theme 'grandshell t) ; recently broke for terminal (load-theme 'zenburn t) ; new fav