fniessen / emacs-leuven-theme

This Emacs theme reduces eye strain with a light, high-contrast color scheme, syntax highlighting, and support for multiple modes. Enhance your coding experience! #emacs #theme #coding #orgmode
GNU General Public License v3.0
696 stars 59 forks source link

[REQUEST] Dark version of theme #21

Closed tantric closed 7 years ago

tantric commented 9 years ago

Leuven is in my opinion the perfect theme. I would like to request a dark version of this theme for use with emacs on the terminal. When using a 'white on black' terminal theme, it would be great to have a matching Leuven theme. Do you have any plans on making a dark version of this amazing theme?

fniessen commented 9 years ago

I also do think that Leuven is the only real theme for Emacs ;-).

Though, I do not have any short to medium plans to build a dark theme, for the first reason I don't use neither Emacs with black backgrounds, nor Emacs in the terminal. But I understand your request, and I'd love to be able to match it.

Time being limited and more interest being ported to other GitHub projects (like Org HTML themes), I really think you should not count on it for some time. But we never know.

Now, would you have some basic elements in place for a dark theme that would be free of rights, I could imagine adding them to Leuven, and slowly improving it over time.

I won't close this, but tag it "enhancement".

tantric commented 9 years ago

Thank you so much for the reply. If I end up hacking up a decent black version of this theme I would definitely let you know. For now I will follow your work. Thank you for making your great available!

fniessen commented 9 years ago

Perfect!

sinewalker commented 8 years ago

Ditto. I notice from a casual glance that Leuven is a lot like Tango colours. I'm wondering if Tango Dark may be a suitable starting point to make a Leuven Dark? Not sure what Tango Dark is like in a terminal -- I'm playing with Spacemacs (which is where I learned of Leuven) and all my themes are currently being ignored in Linux VTs anyway, and emacs --nw still starts an X window...

JohnDDuncanIII commented 8 years ago

I've done a few dark terminal themes over the years. As this is, in my opinion, the most beautiful, aesthetically pleasing, and easiest on the eyes of all emacs themes, I would love to look into messing with a darker version of leuven in the future. Thanks you @fniessen for creating such a beautiful theme.

fniessen commented 8 years ago

Thanks for your so nice comments!

Yes, I'd accept a darker version of my theme, even if I wouldn't use it myself. The first reason why I wouldn't use a dark theme is that I had read, at some point, that white background is better on an ergonomic point of view (true or false?); the second is that it's nice to have a white background as many figures and images also have one such background (and it's more pleasing, then, when displayed in the Emacs buffer); finally, third reason is that I'm now much too used to my light theme...

sinewalker commented 8 years ago

Not sure about the ergonomics. I usually have my display automatically adjust the colour temperature, which is especially helpful for night hacking, but I find the dark background more calming, even in the daytime. For presentations (especially with a projector), or if you're in a very light room or with lots of windows, I will agree that light backgrounds are better.
Sometimes I use a light theme and then use my window manager's colour negative filter to make it dark. That's quite pleasing to look at with Leuven, although the colours' semantics are lost for things like ediff (where red is suddenly cyan, and green is magenta)

MelleB commented 8 years ago

+1! Would be delighted to see this @fniessen!

thblt commented 8 years ago

I've done (or more exactly, generated) a preliminary version of a "leuven-black" theme. It is nothing more than a first draft, but it works. It was made with a really basic Python script which:

  1. Identify everything in a file that looks like a rgb color or an Emacs color name. (Identify here means: regex and character-at-position stuff. Not a hint of real parsing, not even to identify comments)
  2. (If a color name, replace with RGB value)
  3. Negate value only: convert color to HSV, reverse v with some magic constants (255-(0.21r + 0.72g + 0.07b))
  4. Convert back to RGB, put back in the same position in output code, pass everything else as is.

The result looks like this:

2016-10-28-233643_1440x900_scrot

It could obviously use some extra work (which I don't have time to do...), but could still be a starting point for someone willing to improve it. My fork with all the code an a version of the black theme is here.

Feel free to use it any way you want!

fniessen commented 8 years ago

Dear thblt, for sure, it'll need fixes, but this seems to be a great starting point.

Would you like to make a PR?

For information, how did you compute the "negate" constants? Is there some sort of theory about it?

PS- Did you look at my emacs-leuven project? You could be interested by my version of the powerline, which includes VC indicator and dictionary, among others.

PPS- What are the things in your left and right fringes? What do they represent? How do you generate the header above (red is for current buffer)?

thblt commented 8 years ago

Dear fniessen,

Thanks for your feedback! I can of course make a PR. Should I include the three extra files (negate.py, make-dark-theme.sh and emacs_colors.dat) or only the theme ?

Regarding the constants: they're not for negating, but for converting to black-and-white. The point is that human eyes don't have the same sensibility to all wavelengths, and these constants try to match this. There may have been formal studies to determine their exact values, but all I remember is something along the lines of "use these - they work - don't ask why, this magic is too dark for any of us" and tbh, that's all I need. They're not the only possible values, but I found these to give acceptable results.

I need to perform a conversion to black and white because after converting to HSV, the V channel is unusable for negating: it is at its maximum value for a lot of very different colors which actually vary at lot by hue and saturation. Eg, #ff0000 and #ffff00 (pure red and pure yellow) both have 100% brightness, and a naïve conversion will reverse them both to pure black. My strategy use grayscale conversion to determine target lightness. I may give a try to convert to LAB instead of HSV, which seems a lot smarter (the LAB colorspace pretends to be closer from a representation of human vision than any others). I'll try this if I find the time. Someone better at Lisp stuff than me may even write a package to lab-negate any theme (M-x reverse-theme-brightness ?), that would be really cool.

Regarding your PS: I'll have a look at your emacs-leuven, thanks for the pointer !

Regarding your PPS: There's nothing in my fringes, are you referring to my wallpaper (which you can see behind the left window)? The red header comes from my WM (XMonad), which I configured to include small gaps between windows and the red focus header when there are more than one visible, non-floating windows. You can have a look at my XMonad setup, but notice this has nothing to do with Emacs: the wallpaper, the red focus markers and partial transparency of unfocused windows are strictly window manager stuff.

nickserv commented 7 years ago

Should this be closed now? It was mentioned in #32, which was merged.

fniessen commented 7 years ago

Yes, thanks.

Still have to add the screenshot to the README, though...