Emacs Theme Colors are wrong - emacs

I installed Emacs and want to get the atom.io theme, like here:
GitHub
The colors should be:
And now here is a Screenshot how my colors are looking:
I also have atom.io installed and the Preview of the sample is correct. Here is my atom.io screenshot:
Finally, my .emacs config file:
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(load-theme 'atom-one-dark t)
(require 'powerline)
(powerline-default-theme)
(custom-set-variables
;; custom-set-variables 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.
'(custom-safe-themes
(quote
("90d329edc17c6f4e43dbc67709067ccd6c0a3caa355f305de2041755986548f2" "b9c57187960682d4$
'(desktop-save-mode 1)
'(global-hl-line-mode 1)
'(global-linum-mode 1))
(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.
)
Why are the colors different at my Emacs?
Can this be cause i have the wrong color setup? or why could it be wrong?

I ran into the same issue, it seems to be a common for Mac users.
I found some help on the issues section on the GitHub page of a similar theme, dracula. I followed apierz's fixes to correct the colors on my terminal.
From comparing the dracula theme code with the atom one theme, you can see that both themes use a background of hex color #282*. Basically we need to change the hex color of the background to something more compatible.
Comment out this line of code in your atom-one-theme.el file, and add another one with a color value of nil.
;;; Code:
(deftheme atom-one-dark
"Atom One Dark - An Emacs port of the Atom One Dark theme from Atom.io.")
(defvar atom-one-dark-colors-alist
'(("atom-one-dark-accent" . "#528BFF")
("atom-one-dark-fg" . "#ABB2BF")
;; ("atom-one-dark-bg" . "#282C34")
("atom-one-dark-bg" . nil
This should make your background the same color as your terminal window. Since I have a similar background color to #282C34, mine ends up looking a lot like Atom One Dark Theme.
Alternatively, you can set the background color to #000000 (black), however I didn't find it to look too attractive.
Shoutout to apierz for originally posting the fix on GitHub!
what_it_should_look_like.png

Related

Can't get Emacs24 to load themes

To start off, my Emacs version is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-06-06 on barber, modified by Debian, and I am running Debian Jessie as the sole OS on a 2009 Macbook Pro.
So I've downloaded lots of themes off the net that I think would make working in Emacs much more soothing, and placed them in my ~/.emacs.d/themes/ folder. I've downloaded the emacs-goodies-el packages. I've set the custom load path for these themes to be in that specific folder. When I start, I either get one of two things depending on if I actually try to load the themes with (load-theme tron t), or not. Both errors are of the type Symbol's value as variable is void: <!DOCTYPE.
When I run Emacs in --debut-init, this is what I get:
Debugger entered--Lisp error: (void-variable <!DOCTYPE)
eval-buffer() ; Reading at buffer position 14
load-theme(jazz t)
eval-buffer(#<buffer *load*> nil "/home/finnds/.emacs" nil t) ;
Reading at buffer position 1203
load-with-code-conversion("/home/finnds/.emacs" "/home/finnds/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
When I try to load themes through M-x customize-themes, I get the error: load-theme: Symbol's value as variable is void: <!DOCTYPE, and all the colors go back to being white/light/default.
And here is my .emacs file, after the custom-set-variables and custom-set-faces (meaning this is put all the way at the bottom of the file):
(add-to-list 'custom-theme-load-path "~/.emacs.d/")
(load-theme 'jazz t)
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)))
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
I've tried doing exactly what the wiki tells me to do, and several other themesites, but I still keep getting this message. I tried searching for an answer, but there wasn't a particular one like my exact case, I found. Can anyone help me out here? Thanks in advance!
You are trying to load an HTML file, not an Emacs-Lisp file. It sounds like you saved the file wrong. <!DOCTYPE is what tells you this.
The article written by Bozhidar B. and cited by him is misleading. I recommend the EmacsWiki page about this instead. It fairly compares and contrasts color themes, which are provided by library color-theme.el, and custom themes, which were added to vanilla Emacs 24.
These two kinds of theme are not the same thing, and neither replaces the other, in spite of what you might hear. Each has its advantages (and disadvantages) and use cases.
And yes, you can use both -- it is not true that "you shouldn't be doing" this. Read the wiki page, get to know both of them, and then make up your own mind about what works for you.
I say this with no horse in the race. My code (Icicles and Do Re Mi) that lets you cycle themes etc. supports both kinds of themes equally: color themes and custom themes.
You're mixing the old color theme handling (based on the color-theme package) and the Emacs 24.x built-in support for themes, which you shouldn't be doing. I'd suggest having a look at this article to learn more about color themes in Emacs. Here's a minimal setup example (using the zenburn theme):
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(unless (package-installed-p 'zenburn-theme) (package-install 'zenburn-theme))
(load-theme 'zenburn t)
To load a theme that's locally available:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'theme-name t)
This assumes that you've placed an Emacs 24 compatible theme named theme-name in your ~/.emacs.d/themes folder.

Emacs for Windows error loading color theme

I'm using emacs 24.3 on Windows 8. I have installed the solarized color theme from the marmalade repository, and am able to set it using M + x load-theme. It also sets for the current session when I use Customize, but doesn't load when I open emacs again.
I can open the customize menu and select the theme, but saving the changes does nothing, and nothing changes between that and my next session. I looked at several questions here about color themes, but most do not apply to Emacs 24, since I don't need to use color-theme to do it.
Below is a snippet from my .emacs file.
(custom-set-variables
'(custom-enabled-themes (quote (solarized-dark)))
'(custom-safe-themes (quote ("fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default)))
...
When I try to put (load-theme 'solarized-dark t) into my .emacs, I get the error:
error: Unable to find theme file for `solarized-dark'
I've checked the value of custom-theme-load-path after opening emacs and it includes the directory elpa uses to store the solarized theme. As mentioned above, I can load the theme manually, but something about loading it during init is breaking.
Just add
(package-initialize)
To the top of your .emacs file and you are good to go.
Side note: if the theme author has taken care of it, the theme will add itself to the custom-theme-load-path, however this is not a part of the deftheme and is down to individual theme authors implementing this behaviour.
To solve the problem, I made a quick snippet of emacslisp that will find packages with theme in their name, then add them to the custom-theme-load-path at startup.
Just add it near the top of your ~/.emacs or ~/.emacs.d/init.el (ie. before you load-theme
It has dependencies on s.el and dash.el (both available on elpa)
(require 'dash)
(require 's)
(-each
(-map
(lambda (item)
(format "~/.emacs.d/elpa/%s" item))
(-filter
(lambda (item) (s-contains? "theme" item))
(directory-files "~/.emacs.d/elpa/")))
(lambda (item)
(add-to-list 'custom-theme-load-path item)))

Setting Emacs 24 color theme from .emacs

I have the following code in my .emacs:
(if (null window-system)
(progn
(require 'color-theme)
(color-theme-initialize)
(color-theme-simple-1)))
When I open Emacs on the console, I can verify that the progn block runs (by a (message "Got here.")), and I see a flash that suggests that the color theme was loaded, but if it was loaded, it is overridden by something else. If, after loading, I open my .emacs file and submit the block above using C-x C-e, it works. I've tried doing:
(add-hook 'after-init-hook
(lambda ()
(progn
(require 'color-theme)
(color-theme-initialize)
(color-theme-simple-1))))
but that acts the same.
It may be relevant that I'm using Emacs 24, and that this code is not in my .emacs, but in ~/Dropbox/.emacs, which is loaded from my .emacs.
An additional note: I've tried M-x customize-themes, but none of those work acceptably on the console. They either produce a nearly unreadable light theme, or most of the text is invisible.
Emacs 24 has built-in theming, which doesn't use statements like (require 'color-theme). As Drew points out in the comments, there are differences between color themes and custom themes, and the new direction is towards the latter. Try M-x customize-themes to take a look. From .emacs, you can do things like (load-theme 'wombat t).
But...
It may still be going wrong for you. One thing that can mess it up like this is changing the face -- maybe in the custom-set-faces part of your .emacs file. Emacs's interactive customization automatically includes the color information (both background and foreground) of whatever theme you happen to be using at the time you set it, so this can definitely make trouble with color themes. If that is what's causing it, you can just set the particular attribute you care about with something like
(set-face-attribute 'default nil :height 120)
That will change the font size without changing the colors.
Emacs 24 have own theming system.
M-x customize-themes
or
(custom-set-variables
....
'(custom-enabled-themes (quote (selected-theme)))
)

emacs equivalent of vim's bg=dark? (setting background to dark)

In vim, I can run set bg=dark and then vim will adjust all syntax highlighting to work on a terminal with a dark background (whether or not the background actually is dark, vim will assume that it is).
How do I tell emacs to assume that the background is either dark or light?
I've used the invert-face function in the past:
(invert-face 'default)
Or:
M-x invert-face <RET> default
I think the best approach to use is to use ColorTheme. Other options to customize the frame colors you can find here. I can't think about a single command, however you can start emacs with --reverse-video.
M-x set-variable <RET> frame-background-mode <RET> dark
see also the bottom of https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html
Write this at the end of your ~/.emacs file :
;; dark mode
(when (display-graphic-p)
(invert-face 'default)
)
(set-variable 'frame-background-mode 'dark)
Note: The "when" sentence is there to avoid to invert colors in no-window mode (I presume your terminal has already a black background).
The alect-themes package for Emacs 24 provides light, dark, and black themes, and can be installed either manually or using MELPA.
To install alect-themes using MELPA and select alect-dark (from ~/emacs.d/init.d):
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://melpa-stable.milkbox.net/packages/"))
(package-initialize)
(load-theme 'alect-dark)
)
There are quite a few color theme packages in MELPA, so if alect-themes doesn't meet your needs, experiment with some of the others.

Emacs color syntax configuration

Does anyone know if I can find an emacs color syntax configuration which resembles eclipse's syntax coloring? Thank you for any suggestion.
I'm not sure what Eclipse looks like, but you might want to check out Color Theme There are lots of color themes included with it and you can easily create you own if you don't like any you see.
I think you want font-lock. The emacs name for syntax coloring. I get it with the mode (Java mode, C# mode, cc-mode, etc).
I have in my .emacs:
;; for fontification in emacs progmodes:
(load "font-lock")
(setq font-lock-maximum-decoration t)
;; turn on font-lock globally
(global-font-lock-mode 1 'ON)
And then it just works, for all the various prog modes.
Emacs with C# http://www.freeimagehosting.net/uploads/6be39f23a3.jpg
Try this... http://jasonm23.github.com/emacs-theme-editor/
It will customize most of the standard font-lock parameters (keywords, functions, constants, vars, etc....)
You can paste in an existing theme and edit it, if you have something almost right.
There's a few samples on http://jasonm23.github.com
You might also like the code theme generator at http://inspiration.sweyla.com/code/
I use the same .xemacs/init.el file for both Emacs and Xemacs.
In order for it to work, I use the following:
; turn on faces
(font-lock-mode 1)
;; Turn on font-lock mode for Emacs
(cond ((not running-xemacs)
(global-font-lock-mode t)
))
Also you might need to add modes for various files. For example:
(setq auto-mode-alist (mapcar 'purecopy
'(("\\.c$" . c-mode)
("\\.cc$" . c-mode)
("\\.cxx$" . c++-mode)
("\\.htm$" . html-mode)
("\\.java$" . java-mode))))
Note there is also a Go mode for emacs which supports color highlighting. URL for Go-mode for Emacs