tinted-theming / base16-emacs

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

Face definition by indirection — define base16 named colors, or faces to inherit from? #106

Open cben opened 4 years ago

cben commented 4 years ago

I'd like to tweak some things, e.g. the mode line, and maybe style some things not currently styled. But if I use customize-face I see the colors controlled by base16 already resolved to fixed colors such as #93a1a1, and I can only replace them by another fixed color — they'll not change when I flip between face16 themes.

IIUC if I want to change a face to parametric e.g. "use base0B background, whatever it is", the current solution is to fork base16-theme-define? This is consistent with the base16 concept of a "builder", generating a theme of fixed colors, but in Emacs I think we can do better by adding indirection :bulb:

cben commented 4 years ago

BTW, current mechanism for special-handling base16-settings-mode-line-fg and a few other values in base16-transform-color-key, could also be replaced by face inheritance.

belak commented 4 years ago

base16-theme-define exists largely to handle boilerplate in properly defining a theme. Specifically around 256 colors vs terminal vs graphical. Other additions for settings were done because the theme define was already there.

If you can find a convenient way to do this and avoid face definitions tripling in size, I would be open to it.

Theme customization has been on my radar but I haven't had the time to devote to it. In theory you should be able to call base16-theme-define a second time with only the faces you want to override but I don't think that works quite right - that's how I'd picture overriding working.

On the inheritance side, that might work better than settings. That's a good idea.

I'm not sure on having faces for all the base16 colors though... Since they sometimes get used in box definitions as well, we'd need to inherit everywhere there was a different box definition.

belak commented 4 years ago

Thanks for taking the time to write those suggestions out! Elisp isn't one of my stronger languages, so if there's a better way to do something, I'm all ears.

belak commented 4 years ago

Sorry about the misinformation... I was on mobile this morning. base16-set-faces should be used to set faces. Then you can have a set of any definitions you want using the base16 colors. That's the portion I'm not sure works properly after the theme has been defined.

It would be nice if it was possible to call base16-theme-define to create the theme itself then use base16-set-faces to update any faces you want.

cben commented 4 years ago

Thanks, I'll play with base16-set-faces...