I have a function that sets Emacs' color theme to a theme defined by myself. In this function I do:
(set-face-attribute 'default cur-frame :foreground fg-color :background bg-color)
I then set the background color, foreground color, and cursor color for default-frame-alist
, initial-frame-alist
and special-display-frame-alist
.
All of this works fine on my Mac. But when I use this on Linux, it looks fine for all frames that have already been opened, but on newly created frames it looks like this:
I do not have this problem with new frames if use the set-background-color
/ set-foreground-color
functions instead of (set-face-attribute 'default ...
). But if I do that I have to manually reset the colors for every frame that's already open.
I am using Emacs version 23.3 on both Mac and Ubuntu.
For clarification, this is the theme file I use:
my-color.el
Call customize-themes to set a color theme. emacs M-x customize-themes. Click to see the change immediately. Alternatively, call load-theme , then press Tab ↹ to show a list of available themes.
Alt + x load-theme , then press Tab to show a list of available themes. Alternatively, Alt + x customize-themes to set a color theme.
If you prefer a black background (which can be less tiring during long periods of use), you can change the background to black my customizing the default face. To change the background color and other attributes, use the command M-x customize-face , and specify default as the face to customize.
set-face-attribute
sets, as the name suggest, the attributes of a face (i.e., font-related properties), not the attributes of the frame. Use
(add-to-list 'default-frame-alist '(background-color . "lightgray"))
and similar to change frame-related properties.
(if (eq system-type 'darwin)
;; mac os x settings
(if (eq system-type 'gnu/linux)
(setq default-frame-alist '((background-color . "black")
(foreground-color . "gray")))))
something like this should help you maintain settings per OS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With