tinted-theming / base16-emacs

Base16 themes for Emacs
MIT License
382 stars 77 forks source link

Base16-shell compatibility #12

Closed mhartington closed 6 years ago

mhartington commented 9 years ago

Using emacs inside of iterm, with base16-shell running, colors aren't showing up correctly. Any ideas? screen shot 2015-06-28 at 9 13 35 pm

AnthonyDiGirolamo commented 9 years ago

I am having this issue as well. Probably because the themes are defined as hex color values rather than terminal colors. Emacs is trying to match them to the closest 256 color equivalent. I'm pretty new to emacs so I'm not sure how to fix it.

tvjg commented 9 years ago

I'm also trying to figure this out. I'm willing to help if someone could give me some guidance on how to debug. Or at least an up-to-date resource on how emacs handles colors and face -- it's overwhelming to sift through. These issues from solarized seem related:

https://github.com/sellout/emacs-color-theme-solarized/issues/60 https://github.com/sellout/emacs-color-theme-solarized/issues/62

I also noticed that the light themes look pretty close to correct already. If I run (set-background-color "black"), the glaring orange background goes away.

Is this even the right issue tracker @mkaito or should we take this discussion over to base16-shell?

mkaito commented 9 years ago

I just provide this issue for ELPA convenience. Development happens in base16-builder. I am "officially" the maintainer of the emacs template, I guess, but I'm not actually very experienced with emacs themes, especially when it comes to emacs in the console. I've never gotten that to work since we switched to deftheme.

Perhaps if you take discussion over to base16-builder, more people would see it. I'm eager to get this solved, since it also affects my daily workflow.

If it's worth anything, base16-shell also messes vim's colours up.

AnthonyDiGirolamo commented 9 years ago

I think I've got a solution. See pull request #13. With that get consistent colors in rxvt and iTerm in OS X.

senthilbaboo commented 8 years ago

I have created a pull request to fix this in the base16 builder: https://github.com/chriskempson/base16-builder/pull/347 by extending the solution of @AnthonyDiGirolamo a bit.

mkaito commented 8 years ago

That's great! I'm not sure upstream is actually doing anything. Last news I heard was that they wanted to split themes into their own packages/repos, but it seems like nothing has happened since.

senthilbaboo commented 8 years ago

@mkaito As base16-builder project is kind of stale, it is possible for you to generate the new theme files with my pull request and release them to melpa for emacs?

belak commented 8 years ago

There's a fork of the base16-builder package which solves this issue.

They used this method: https://github.com/auduchinok/base16-builder/commit/77714c235b04231dc8e25e8156d526f93043d729

Alternatively, this repo could switch to using that base16-builder as it seems more active.

belak commented 8 years ago

This should be resolved in 51b0fcdce617047141eec43567aae64a9bce9f63. It was based off of the base16-xresources colors and should work if you have a base16 terminal scheme in use as well.

However, I haven't tested with the -256 variety, so I'm not closing this just yet.

belak commented 8 years ago

I believe this has been fixed. I've tried it against the base16-default.dark and base16-default.dark.256 iterm2 color schemes.

Please let me know if you have any additional problems.

belak commented 8 years ago

I spoke too soon. Still needs to be fixed for the 256 schemes.

zagortenay333 commented 7 years ago

Still have this issue with emacs 24.5.1. Tried under gnome-terminal and urxvt.

Also, comments and the mode line in all themes seem to have the same weird pale violet color instead of the color corresponding to brightblack.

Before setting the background to black. selection_002

Comment should be gray in the oceanicnext theme, but it's violet. selection_003

On vim for comparison. selection_005

belak commented 7 years ago

Do you have a screenshot of what you're seeing? And you're using base16-gnome-terminal, base16-shell, and base16-emacs together?

zagortenay333 commented 7 years ago

I added screenshots to my comment. Yeah, I'm using base16-gnome-terminal, base16-shell and base16-emacs.

zagortenay333 commented 7 years ago

I don't have any issues with vim.

belak commented 7 years ago

What's the value of $TERM?

I always seem to have issues reproducing issues with base16-shell interactions... so feel free to provide any information you think might help me reproduce this.

I think this may be an issue with how the setup handles 256 color terminals using base16-shell... right now we just let emacs do the color conversions (since passing in the actual colors will let emacs convert them to the 256 colorspace provided by the terminal), but that may not be the best approach because base16-shell mangles the 256 colorspace.

zagortenay333 commented 7 years ago

TERM=xterm-256color

zagortenay333 commented 7 years ago

I spent way too much time on this, and I have no clue why it isn't working. Can't think of anything more I could add. :/

belak commented 7 years ago

Out of pure curiosity, does emacs display properly if you don't source base16-shell? (Not a solution, just for debugging)

Similarly, does it display properly with TERM=xterm?

zagortenay333 commented 7 years ago

Nope.

belak commented 7 years ago

I'm really not sure how to fix this... this displays correctly for me using emacs 25.1.1 both with and without base16-shell on gnome-terminal 3.22.1 with vte 0.46.1.

belak commented 7 years ago

If you're interested in fixing this, there's a chance that the base16-shell-colors variable (in base16-theme.el) could be changed to use the additional colorspace provided by base16-shell. I believe this would need to be customized before the themes are loaded, so it may be easiest to mess around with it in the file itself.

belak commented 7 years ago

In a few hours, there will be a new build on melpa... can you test that and let me know if it fixes this for you? I don't use terminal emacs, so I'm not 100% sure my hacked-together setup will match what everyone is trying to do.

zagortenay333 commented 7 years ago

It's better. The annoying background is gone, and the color of the comments is correct now, but there are still some issues: screenshot from 2017-03-27 16-44-28

The comment slashes (//) are yellow, the highlighted (current) line is green and the bar is yellow. :/

belak commented 7 years ago

@zagortenay333 Are you using base16-shell? Also (forgot to mention it) but you may need to put (setq base16-theme-use-shell-colors t) before loading the theme.

zagortenay333 commented 7 years ago

Setting setq base16-theme-use-shell-colors t solved the problem. Thx!

I guess this issue can be closed now.

zagortenay333 commented 7 years ago

Btw, this should really be mentioned in the README.

mkaito commented 7 years ago

Do you reckon this could be automated by checking whether emacs is running in a terminal?

samir-memsql commented 7 years ago

I'm seeing this issue as well. The behavior without setq base16-theme-use-shell-colros t is almost the same as for zagortenay333, but with it is still very wrong:

screenshot from 2017-03-28 11-59-54

I'm using most recent commit on base16-emacs/master and the base16-shell. My .Xresources is configured directly from base16-xresources.

[2017-03-28 12:03:41] samir@host ~
$ echo $TERM
rxvt-unicode-256color
[2017-03-28 12:03:44] samir@host ~
$ emacs --version
GNU Emacs 24.5.1
belak commented 7 years ago

@samir-memsql Yes, you need base16-theme-use-shell-colors to use this with base16-shell for now.

@zagortenay333 I'll add it to the readme. Just wanted to make sure it worked first, since I use gui emacs and I'm sure there was something weird about my setup.

@mkaito Yes, this would be possible, but I'd prefer to default to the non-256 colorspace version, similar to what the vim theme does.

The base16-vim theme does something similar. I may change the variable name, but this general approach will probably be used.

samir-memsql commented 7 years ago

@belak Sorry for the confusion, my point was that the colors appear very wrong with or without base16-theme-use-shell-colors.

belak commented 7 years ago

What terminal/TERM value?

samir-memsql commented 7 years ago
[2017-03-28 13:01:09] samir@host ~
$ dpkg --list | grep rxvt
ii  rxvt-unicode-256color                         9.21-1build1                                  amd64        multi-lingual terminal emulator with Unicode support for X11
[2017-03-28 13:01:12] samir@host ~
$ echo $TERM
rxvt-unicode-256color
belak commented 7 years ago

Well, I've added another option (and removed the previous one).

For 256 color terminals, there are 3 options:

These can be set using the base16-theme-256-color-source variable.

For people still having trouble using terminal or base16-shell, I'd recommend using colors.

belak commented 6 years ago

If there's anyone still having trouble with this, please let me know. I plan on closing this as soon as I get a chance to update the documentation. Thanks to everyone for your feedback and help testing this!

samimb commented 6 years ago

I'm still having issues with this.

+BEGIN_SRC emacs-lisp

(setq base16-theme-use-shell-colors t)

+END_SRC

+begin_src emacs-lisp

(use-package base16-theme :ensure t :config (load-theme 'base16-google-light t))

+end_src

belak commented 6 years ago

The setting changed quite a while back. There's some more information here: https://github.com/belak/base16-emacs/blob/master/base16-theme.el#L17

This may fix it for you: (setq base16-theme-256-color-source "base16-shell")

samimb commented 6 years ago

That works great!