tinted-theming / base16-emacs

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

Add faces for spacemacs modes #64

Closed shitikanth closed 6 years ago

shitikanth commented 6 years ago

Before: 2017-12-10-222417_1360x768_scrot

After: 2017-12-10-222439_1360x768_scrot

belak commented 6 years ago

Where are these faces defined? I can't find them anywhere in https://github.com/syl20bnr/spacemacs/ or https://github.com/TheBB/spaceline/

As far as I know it depends on https://github.com/syl20bnr/spacemacs/issues/8378

EDIT:

Is there any reason we can't just set these variables inside base16-theme-define? I realize that means we won't be able to restore them after the theme is unloaded, but I might consider that an acceptable trade-off. If evil/spacemacs doesn't provide faces, it's reasonable that we work around it.

shitikanth commented 6 years ago

@belak the spacemacs fonts are set dynamically using something like

(intern (format "spacemacs-%s-face" state))

If you search for "spacemacs-%s-face" you should be able to find the places where they are defined.

Setting the spacemacs-normal-face, spacemacs-insert-face etc inside base16-theme-define works fine and it gets restored after you load another theme etc. These faces set what the

The problem is with the cursor settings for evil. Evil expects cursor settings to be set in variables evil-normal-state-cursor etc and they are not faces. They contain the cursor color as well as a cursor-type, which then evil uses to set the face and type of cursor dynamically based on the mode.

If we want the cursor color to be the same as the color of spacemacs state shown in spaceline (or change customize the evil state colors for any other reasons), we must set the "evil-%s-state-cursor" variables.

The solution I have for this currently in my config is to add a hook that updates the cursor colors after load-theme. The hook sets the cursor color based on base16 colors if the theme is base16 or resets them to the default spacemacs colors for any other theme.

https://gist.github.com/shitikanth/60e7d8dc8f826adf7be8717586abb533

belak commented 6 years ago

Ah, I see. Thanks for the info!