dylanaraps / pywal

🎨 Generate and change color-schemes on the fly.
MIT License
8.34k stars 325 forks source link

Emacs Theme #413

Open jcaw opened 5 years ago

jcaw commented 5 years ago

I've been working on a full Emacs theme on this branch of theme-magic, an Emacs package designed to export Emacs' color scheme to Pywal. This is my attempt at having Emacs generate its colors from wal.

Here are some results from the current version of the theme:

2019-05-07_08-36-00__May-07

2019-05-07_08-36-47__May-07

2019-05-07_09-04-59__May-07

2019-05-07_09-06-08__May-07

The theme is a single -theme.el file, adapted from the Spacemacs themes (light and dark variants). I chose them because they're attractive, comprehensive, and their design principles were easy to reverse-engineer and emulate on-the-fly. I take the 16 Pywal colors, produce intermediate colors in a similar style to the Spacemacs themes, and apply them.

The theme currently follows two architectural principles that ensure it can be turned into a template file for Pywal:

Currently, I'm pulling the colors from ~/.cache/wal/colors.json each time the Emacs theme is loaded. Ideally, I want to have the theme file generated automatically by Pywal. I can then extend theme-magic to subscribe to Pywal updates and handle updating the Emacs theme automatically.

This theme file is complex - it's not just a set of colors. It has a lot of logic embedded within it so it can produce something attractive and functional from a 16-color input. In PR #43, complexity was not preferred, but this is inherently challenging with Emacs. Themes are essentially written as functions, and good themes tend to be large and use a wide range of colors. Personally, I figure aesthetics are paramount. The point of Pywal is to be aesthetically pleasing. I didn't want to sacrifice that for simplicity.

So, basically, my question is what to do next. I've been co-ordinating with the ewal maintainer and we've both taken different approaches, with some crossover. He wasn't sure how to proceed either.

deviantfero commented 5 years ago

I do this with wpgtk with a template, I was thinking of releasing as stand-alone package:

(defun get-hex-or-term (n)
  "Gets N hex or a term color depending on whether we're using an GUI or not."
  (cond ((eq n 0)  (if (display-graphic-p) "{color0}"  "black"))
        ((eq n 1)  (if (display-graphic-p) "{color1}"  "red"))
        ((eq n 2)  (if (display-graphic-p) "{color2}"  "green"))
        ((eq n 3)  (if (display-graphic-p) "{color3}"  "yellow"))
        ((eq n 4)  (if (display-graphic-p) "{color4}"  "blue"))
        ((eq n 5)  (if (display-graphic-p) "{color5}"  "magenta"))
        ((eq n 6)  (if (display-graphic-p) "{color6}"  "cyan"))
        ((eq n 7)  (if (display-graphic-p) "{color7}"  "white"))
        ((eq n 8)  (if (display-graphic-p) "{color8}"  "brightblack"))
        ((eq n 9)  (if (display-graphic-p) "{color9}"  "brightred"))
        ((eq n 10) (if (display-graphic-p) "{color10}" "brightgreen"))
        ((eq n 11) (if (display-graphic-p) "{color11}" "brightyellow"))
        ((eq n 12) (if (display-graphic-p) "{color12}" "brightblue"))
        ((eq n 13) (if (display-graphic-p) "{color13}" "brightmagenta"))
        ((eq n 14) (if (display-graphic-p) "{color14}" "brightcyan"))
        ((eq n 15) (if (display-graphic-p) "{color15}" "brightwhite"))))

of course there's a lot of code I'm omitting, but I base the rest on this

TS-CUBED commented 2 years ago

What is the progress on this? I currently am looking for a way to couple emacs and wal and came across this, which seems to be what I was after.

bakerk98 commented 2 years ago

Check the wiki, theres a "customization" tab that has a link to an Emacs .Xresources theme thing, it works fine as long as you aren't using pure gtk Wayland Emacs