sellout / emacs-color-theme-solarized

Emacs highlighting using Ethan Schoonover’s Solarized color scheme
http://ethanschoonover.com/solarized
MIT License
1.16k stars 201 forks source link

Very different background color from Vim? #5

Closed al3x closed 13 years ago

al3x commented 13 years ago

I'm filing an issue rather than just submitting a patch because I'm not sure if this is intentional or not.

Check out this screenshot. Vim with Solarized dark is on top. Emacs with Solarized dark is on the bottom. Same file. Both editors are using the latest version of Solarized as of about an hour ago.

Now, I don't expect that every color will be the same because of differences in Markdown mode implementations and color semantics between the two editors. But you can see a pretty marked difference between the background color in Vim and the background color in Emacs. The background in Emacs is significantly lighter and, to my eyes, more green.

Is this the intended effect? Would you mind posting a screenshot from your system as part of the README?

sellout commented 13 years ago

This isn't intentional. As I understand it, this is a bug with Cocoa Emacs’ color handling. If you use some color sampler, and check the color of the pixels in Emacs, you'll see that they’re different from the color codes specified in the theme.

I should look into a way to handle this, but I’m not sure how, exactly.

al3x commented 13 years ago

Interesting, thanks.

I created a new comparison screenshot that includes iTerm, MacVim, Emacs, and IntelliJ IDEA, all running Solarized Dark. Interestingly, IDEA and Emacs both seem to be buggy in the same way; perhaps they're calling an antiquated color API or something? iTerm and MacVim both match up to the screenshots on the Solarized homepage.

antifuchs commented 13 years ago

That these colors look lighter might be some misguided alpha composition. I just looked it up on Programming with Quartz, and while there is a color space selection difference between OS X Panther and the ones that came before, they are pretty much the same, except the Panther+ routines are faster.

What I think might be happening is that there's a global alpha channel that gets applied to the emacs frame contents. I'm still waiting for the emacs source code to finish downloading via bzr, so can't look it up properly, but I'll check if that's what is happening.

At any rate, I think we could just transform the emacs-solarized color values on the mac into values that will result in the right colors being displayed.

bkudria commented 13 years ago

There is already a bug report filed on Emacs about this issue: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402

sellout commented 13 years ago

Thanks to @akrito, @purcell, and @SeanTAllen, I've put in a set of "Generic RGB" colors that are now used by default. I think these won't actually be perfect for everyone, but hopefully better than the sRGB values. Please let me know what you think (and screenshots with color comparisons are very helpful).

Thanks.

purcell commented 13 years ago

Hey Greg/others! From what I can tell, I think that the color specs need to be conditional, since only Cocoa Emacs on OS X gets the colors wrong. In the Emacs bug report I filed, the devs seem to concede that the current behavior is unexpected, and presumably it will then get fixed. In the meantime, I'd be worried that these modified RGB colors wouldn't display correctly on Linux & Windows.

My version of the solarized theme for Emacs (https://github.com/purcell/color-theme-sanityinc-solarized) currently uses only the RGB values (after I back-calculated them using the Apple colorspace utility), because I only care about OS X right now, but I expect to have to fix things up when the Cocoa Emacs bug is fixed.

It'd be great if someone could confirm whether these new colors render correctly on non-OS X Emacsen.

SeanTAllen commented 13 years ago

@purcell actually i had the same issue with AquaMacs, Cocoa Emacs & Standard X Emacs on Linux.

So... the 'only a cocoa emacs' bug doesn't hold uip to my standard experience.

The RGB converted colors display correctly for me at home ( Cocoa Emacs ) & at work ( Standard X Emacs ).

purcell commented 13 years ago

Ah, good to know - thanks Sean! I guess I'll have to close the Emacs bug report then...

altercation commented 13 years ago

@purcell, @sellout, et al.

Sorry I didn't get in on this earlier. Has there been any more intel on what internal colorspace emacs gui / aquamacs is using in this case? Is it indeed using a generic rgb space?

@purcell, I generated two different sets of Generic (colorspace) values. The first were done using colorpicker, the second using ColorSync Utility. My first set is fairly close to the values you use. The second set is quite different as I actually did conversion directly from the Solarized LAB values. I'm including them here and would encourage testing using the new LAB->Generic converted values in the second column to see if they are more accurate than the first column (not sure why your values are slightly different, maybe using a different CMM).

             COLORPICKER  APPLE CMM
             SWATCH       GENERIC   
base03       #042029      #002029   
base02       #0A2933      #0A2932   
base01       #475B62      #475B62   
base00       #536870      #53686F   
base0        #708284      #718283   
base1        #819090      #819090   
base2        #EAE3CB      #EAE2CB   
base3        #FCF4DC      #FCF4DC   
yellow       #A57706      #A57703   
orange       #BD3613      #BD3713   
red          #D11C24      #D11C24   
magenta      #C61C6F      #C51C6F   
violet       #595AB7      #5859B7   
blue         #2176C7      #2176C7   
cyan         #259286      #269286   
green        #738A05      #738A00   
purcell commented 13 years ago

Hey Ethan,

Thanks for this.

There's been no word on what color space Emacs uses internally, but since the "generic RGB" values Greg & I have been using in our Emacs themes look right on non-Mac platforms, I guess Emacs' colorspace is not explicitly the display colorspace of the host system. My guess is that changing (fixing?) that on all Emacs platforms is not going to happen.

I've taken color picker swatch results of solarized in my Emacs, using both my source RGB values and yours (in columns 1 & 2 of your table). None of our color sets get as close to the desired values as they should, from what I can see:

         Yr RGB (1) Yr RGB (2) My RGB  =>  Yr RGB (1) Yr RGB (2) My RGB   Wanted
base03   042029     002029     042028  =>  002b37     002b37     002b36   002b36
base02   0A2933     0A2932     0a2832  =>  003743     003742     003642   073642
base01   475B62     475B62     465a61  =>  526f76     526f76     516e75   586e75
base00   536870     53686F     52676f  =>  5f7c84     5f738c     5e7b83   657b83
base0    708284     718283     708183  =>  7e9597     7f9596     7e9496   839496
base1    819090     819090     81908f  =>  8fa2a2     8fa2a2     8fa2a1   93a1a1
base2    EAE3CB     EAE2CB     e9e2cb  =>  f0e9d4     f0e8d4     efe8d4   eee8d5
base3    FCF4DC     FCF4DC     fcf4dc  =>  fef7e2     d3d7e2     fef7e2   fdf6e3
yellow   A57706     A57703     a57705  =>  be8a00     be8a00     be8a00   b58900
orange   BD3613     BD3713     bd3612  =>  dd3c00     dd3d00     dd3c00   cb4b16
red      D11C24     D11C24     c60007  =>  f10020     f10020     e80000   dc322f
magenta  C61C6F     C51C6F     c61b6e  =>  e70081     e60081     e70080   d33682
violet   595AB7     5859B7     5859b7  =>  6b6ac7     6a68c7     6a68c7   6c71c4
blue     2176C7     2176C7     2075c7  =>  0088d5     0088d5     0087d5   268bd2
cyan     259286     269286     259185  =>  00a699     00a699     00a598   2aa198
green    738A05     738A00     728a05  =>  809e00     809e00     7e9e00   859900

-Steve

flavorjones commented 13 years ago

FWIW, on Emacs running on Ubuntu, the sRGB values give me something very (perceptibly) close to the Vim screenshot in the original description.

For comparison, Here's a screenshot of my Emacs (with cyan tweaked for red-green colorblindness) using the original sRGB values.

SeanTAllen commented 13 years ago

Flavorjones,

That is weird. My emacs on ubuntu looks nothing like that with sRGB values.

I'm using 23.1.1.

You?

flavorjones commented 13 years ago

@SeanTAllen, I'm running GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0) on Maverick. This is from the emacs-snapshot 1:20090909-1 package.

altercation commented 13 years ago

@purcell @sellout et al. - I just downgraded to emacs 23 and color-theme to normalize. Just testing the background in light mode it is spot on (i.e. your original Generic values that are currently in @sellout's repo: #fcf4dc in this case).

I want to normalize our tests, @purcell : digital color meter is going to be reading the color as transformed to the output device colorspace, so the numbers you are reporting above have already undergone that change (i.e. from Generic->Current Device space).

Can you switch your current monitor profile to sRGB and retest the background in light mode, for instance? I suspect you are using a different monitor calibration (as you should) which is (rightly) giving different RGB hex values. By switching the sRGB we are simply using the output, transformed RGB values read with Digital Color meter as a calculated Generic-sRGB in order to confirm that the source space is indeed Generic.

(my assumption from this is that your current Generic space (second column) values are in fact 100% correct).

purcell commented 13 years ago

@altercation Okay; just to be clear, I'm using Apple's default "Color LCD" profile for my OS X 10.6 MBP's built-in display. And to back-calculate the generic RGB values I used Digital Color Meter to sample the colors from the Solarized web page -- those colors showed up as the sRGB values you list on that page, and I plugged them into ColorSync Utility's calculator to get my values.

Switching my display temporarily to the sRGB profile (which of course looks horrible! :-)), Digital Color Meter reads my base3 as #fdf6e3, base03 as #002b35, orange as #cb4b15 and violet as #6b70c4, as a somewhat random sample. These are more uniformly close to the desired values: orange, in particular, is quite inaccurate for me normally.

No idea what to conclude from all this, but I know that I wish Emacs used colors in the output color space...

altercation commented 13 years ago

@purcell

Yes, sRGB as your monitor profile will look terrible. Don't leave it there :) (I'm sure you haven't). We're just using your display profile as a calculator since we can't measure accurately with digital color meter any other way.

Those values look fine. The minor differences (#6b70c4 vs the canonical #6c71c4) are due to the fact that you generated the Generic Space hex values using Apple's color management, not Adobe's (which I used initially, they are similar enough, only minor differences) and they are getting transformed back to sRGB using Apple's engine again. Just different transform algorithms. I could care less about these small differences as the LAB values will give the same minor differences using Apple vs Adobe engines as well, and the LABs are the only true canonical values.

So as far as I'm concerned that is 100% confirmation that emacs gui is currently reading all hex values as Apple Generic color profile values, which are then converted (appropriately) to whatever the current output device profile is.

This is ok, but they really should switch to sRGB as it's more standard now. Generic is just Apple's sRGBish profile that nobody else uses.

So the bottom line is: all your values are correct, ignore the values I submitted previously, proceed with impunity. :)

purcell commented 13 years ago

Thanks Ethan - you rock.

There is indeed some suggestion that sRGB might be a better standard for Emacs now, which I'm trying to do my best to encourage: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402

andersjohansson commented 13 years ago

I also find some differences, but with emacs being much darker than others (using solarized-dark). Screenshot with emacs, gedit (using theme from: https://github.com/mukashi/solarized/) and gnome-terminal: http://imageshack.us/photo/my-images/864/solarized.png/