jonathanchu / atom-one-dark-theme

Atom One Dark - An Emacs port of the Atom One Dark theme from Atom.io.
GNU General Public License v3.0
255 stars 52 forks source link

issues displaying colors #57

Closed p-z-l closed 5 years ago

p-z-l commented 5 years ago

Hi, I'm new to emacs.

I've installed the theme and activated it by selecting Options → Customize Emacs → Custom Themes > atom-one-dark on the menu.

But my interface looks like this:

emacs-onedark-error

I'm using iTerm (build 33.0) on Mac, terminal type is xterm-256color and emacs version is 26.2

jhacksworth commented 5 years ago

Hi @p-z-l,

Welcome to Emacs!

Your screenshot actually looks OK to me. Which colors are you referring to? Is it the mode line, menu bar, or the colors used for the emacs lisp code?

p-z-l commented 5 years ago

I mean, in GUI emacs mode, the background color should be much more blue, and the text colors in CLI emacs is also much different comparing with those in GUI Here's what it looks like in GUI emacs:

image

I think the problem is the my CLI emacs supports only 256color, while the GUI emacs can display 24-bit color.

jhacksworth commented 5 years ago

I think the problem is the my CLI emacs supports only 256color, while the GUI emacs can display 24-bit color.

Yes, exactly. In 256 color terminals, the colors are limited and won't match perfectly with the 24-bit colors.

However, you should be able to get 24-bit color working in iTerm running Emacs 26. Here's how I did it, I'll include some links for reference.

  1. Create the file terminfo-24bit.src and copy the following content into it:

    # Use colon separators.
    xterm-24bit|xterm with 24-bit direct color mode,
        use=xterm-256color,
        setb24=\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm,
        setf24=\E[38:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm,
    # Use semicolon separators.
    xterm-24bits|xterm with 24-bit direct color mode,
        use=xterm-256color,
        setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
        setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,

    (Make sure you have a newline at end of file or you may get errors)

  2. Run the following command in the same directory as the file you just created. It will create the directory ~/.terminfo in your home dir, if it doesn't already exist, and create two new terminfo entries, xterm-24bit and xterm-24bits:

    $ tic -x -o ~/.terminfo terminfo-24bit.src
  3. Use

    • xterm-24bit if you're running Emacs in iTerm by itself

    • xterm-24bits if you're running tmux in iTerm

    • To test it out:

      # emacs running in iTerm (xterm-24bit)
      $ env TERM=xterm-24bit emacs -nw
      
      # emacs running in tmux running in iTerm (xterm-24bits)
      $ env TERM=xterm-24bits emacs -nw
  4. If it works, you could create aliases, for example:

    # emacs running in iTerm (xterm-24bit)
    $ alias enw='env TERM=xterm-24bit emacs -nw'

Reference:

p-z-l commented 5 years ago

DEAL WITH IT Thanks a lot for helping me out

P.S. emacs is awesome

jhacksworth commented 5 years ago

I'm happy to hear you got it working! 😄