emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Theme generator


From: Arthur Miller
Subject: Re: Theme generator
Date: Thu, 17 Sep 2020 16:25:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

chad <yandros@gmail.com> writes:

> On Tue, Sep 15, 2020 at 6:49 PM Tim Cross <theophilusx@gmail.com> wrote:
>
>  At present, while you have all the power to customize faces, it isn't 
> necessary easy to get things consistent. [...]
>
>  The spacemacs setup also has a pretty straight-forward way to tweak existing 
> themes with their theming-modifications list,
>  which makes it easy to tweak specific settings for specific themes (and 
> ensures they are applied when themes change or are
>  re-loaded etc).
>
> I recently tried to do a very similar task in a way that didn't feel hacky. I 
> set myself a pretty short timeout, and didn't make it, so
> this idea sounds interesting. Digging in, I found this example (link to 
> github):
> https://github.com/syl20bnr/spacemacs/tree/develop/layers/%2Bthemes/theming#example
>
> (defun dotspacemacs/user-init ()
>   (setq theming-modifications
>         '((monokai
>            ;; Font locking
>            (font-lock-comment-face :slant italic)
>            (web-mode-html-attr-name-face :inherit font-lock-variable-name-face
>                                          :foreground nil)
>            ;; Modeline
>            (powerline-active1 :box (:color "#999999"
>                                     :line-width 1
>                                     :style released-button)
>                               :background "#5a5a5a")))))
>

Here is visible what is a problem with current theme engine: 

>            (powerline-active1 :box (:color "#999999"
>                                     :line-width 1
>                                     :style released-button)
>                               :background "#5a5a5a")))))


In order to syle an element 3rd party package will specify raw rgb
values for an element. If theme-engine offered parametrized names like
say, :color color-scheme-foreground instead of #999999, then when user
sets a color for the color-scheme-foreground the element would pick it
up from the theme and there would be no need for 4th party developer,
theme modders, like base16 or Solarized devs, to look at the code, and
re-style it in their own code to bring that package into their theme.
See for example:

;;;; powerline
     `(powerline-active1 ((,class ,(if solarized-high-contrast-mode-line
                                       `(:background ,base00 :foreground 
,base03)
                                     `(:background ,base03 :foreground 
,base00)))))
     `(powerline-active2 ((,class ,(if solarized-high-contrast-mode-line
                                       `(:background ,base01 :foreground 
,base03)
                                     `(:background ,base02 :foreground 
,base00)))))
     `(powerline-inactive1 ((,class ,(if solarized-high-contrast-mode-line
                                         `(:background ,base03 :foreground 
,base1)
                                       `(:background ,base02 :foreground 
,base01)))))
     `(powerline-inactive2 ((,class ,(if solarized-high-contrast-mode-line
                                         `(:background ,base02 :foreground 
,base1)
                                       `(:background ,base03 :foreground
     ,base01)))))

as found in Solarized:

https://github.com/bbatsov/solarized-emacs/blob/master/solarized-faces.el

Thomas "linuxteam" suggested to use faces instead of colors, which
probably is even better then using just colors, albeit it might be that
color framework is needed at lower level to customize faces. I am not
really sure, since I am not so acquainted with face-machinery and how it
really works (yet).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]