tinted-theming / base16-emacs

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

Emacs doesn't update colors with updated theme until I restart Emacs #79

Open makuto opened 5 years ago

makuto commented 5 years ago

I am working on a script which automatically generates a base16 theme from a source image's color palette.

Development is going well except for the fact that I have to close and reopen Emacs in order to see my theme's changes.

I have tried the following:

The goal is to have my theme automatically update when my desktop wallpaper changes. That won't be possible if I have to close and reopen Emacs to see the theme change.

belak commented 5 years ago

I'm not entirely sure why it doesn't seem to work, but I ran into this a while back when making tweaks. If you change the colors passed in and call base16-theme-define, I'd expect the theme to be updated, but I'm not sure what happens when you redefine faces in a theme.

It's not a very high priority for me, but if you figure it out, I'd be happy to accept a PR that changes how this works if that would make it easier to make theme tweaks in the future.

koddo commented 2 years ago

Probably after configuring properties of a theme, it should be re-enabled with enable-theme.

An example:

(use-package base16-theme
  :after org
  :config
  (deftheme ym-base16-theme)

  (progn
    (setq ym-base16-colors (list
                :base00 "white"      ; Default Background
                :base01 "grey90"     ; Lighter Background (Used for status bars)
                :base02 "#d8d8d8"    ; Selection Background
                :base03 "grey60"     ; Comments, Invisibles, Line Highlighting
                :base04 "#585858"    ; Dark Foreground (Used for status bars)
                :base05 "grey25"     ; Default Foreground, Caret, Delimiters, Operators
                :base06 "#282828"    ; Light Foreground (Not often used)
                :base07 "#181818"    ; Light Background (Not often used)
                :base08 "#ab4642"    ; Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
                :base09 "#dc9656"    ; Integers, Boolean, Constants, XML Attributes, Markup Link Url
                :base0A "#f7ca88"    ; Classes, Markup Bold, Search Text Background
                :base0B "#a1b56c"    ; Strings, Inherited Class, Markup Code, Diff Inserted
                :base0C "#86c1b9"    ; Support, Regular Expressions, Escape Characters, Markup Quotes
                :base0D "#7cafc2"    ; Functions, Methods, Attribute IDs, Headings
                :base0E "#ba8baf"    ; Keywords, Storage, Selector, Markup Italic, Diff Changed
                :base0F "#a16946"    ; Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
                ))
    (base16-theme-define 'ym-base16-theme ym-base16-colors)
    (enable-theme 'ym-base16-theme)
    )

  ;; temporarily fixing this: https://github.com/belak/base16-emacs/issues/114
  ;; font-lock-comment-delimiter-face should be base03, not base02
  (set-face-attribute 'font-lock-comment-delimiter-face nil :foreground (plist-get ym-base16-colors :base03))
  )
jeffbowman commented 2 years ago

You could try calling disable-theme before loading your theme.

example:

(disable-theme 'deeper-blue)
(load-theme 'ym-base16-theme t)