~protesilaos/modus-themes

4 2

'make-obsolete' should be 'make-obsolete-variable' in some cases in the version-4 branch

Details
Message ID
<CAKJdtO-dzvR=2BaSd5qPzwDE=+aJSR6js7ii1O6KD7oFOB7gDw@mail.gmail.com>
DKIM signature
missing
Download raw message
Hi,
I checked out the updates in version-4 and noted that some earlier
customization variables were removed (as expected). However, they were
not defined as obsolete variables. I found that you used
`make-obsolete' (which is for functions) also for variables.

I see where you are going with simplifying this. Great work!
Personally, I think I will need to tweak back some of the subtler grey
backgrounds for the screens I use. Would there be a possibility to
customize the base colors in the themes in how you envision the future
design? I would for example be happy to use the old lighter
'bg-active' colour (#d7d7d7).

Best,
Anders Johansson
Details
Message ID
<87k034ezg3.fsf@protesilaos.com>
In-Reply-To
<CAKJdtO-dzvR=2BaSd5qPzwDE=+aJSR6js7ii1O6KD7oFOB7gDw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
> From: Anders Johansson <mejlaandersj@gmail.com>
> Date: Tue,  6 Dec 2022 22:40:31 +0100
>
> Hi,

Good day Anders,

> I checked out the updates in version-4 and noted that some earlier
> customization variables were removed (as expected). However, they were
> not defined as obsolete variables. I found that you used
> `make-obsolete' (which is for functions) also for variables.

Oh right...  I will update it now.

> I see where you are going with simplifying this. Great work!

Thank you!  It still is a work-in-progress, but I think it makes sense
to improve on some default styles and otherwise remove the relevant
option.  Though I am happy to reconsider some of those I removed.  It is
not a final decision.

In other words, if you have any suggestions on this front, please let me
know.

> Personally, I think I will need to tweak back some of the subtler grey
> backgrounds for the screens I use. Would there be a possibility to
> customize the base colors in the themes in how you envision the future
> design? I would for example be happy to use the old lighter
> 'bg-active' colour (#d7d7d7).

I think allowing for colour overrides is a sensible approach.  I will
review the 'modus-themes-theme' macro to see how best to do it.

The other way is to create a separate theme which uses all the desired
colours.  For the latter approach, I will document everything in the
manual.  Basically, the user copies, say, modus-operandi-theme.el
replaces "operandi" with NAME and then adds the file to the
'custom-theme-load-path'.

All the best,
Protesilaos (or simply "Prot")

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<87cz8vdi54.fsf@protesilaos.com>
In-Reply-To
<87k034ezg3.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
Patch: +9 -4
> From: Protesilaos Stavrou <info@protesilaos.com>
> Date: Wed,  7 Dec 2022 04:10:20 +0200

> [... 25 lines elided]

>> Personally, I think I will need to tweak back some of the subtler grey
>> backgrounds for the screens I use. Would there be a possibility to
>> customize the base colors in the themes in how you envision the future
>> design? I would for example be happy to use the old lighter
>> 'bg-active' colour (#d7d7d7).
>
> I think allowing for colour overrides is a sensible approach.  I will
> review the 'modus-themes-theme' macro to see how best to do it.

> [... 9 lines elided]

Hello again Anders,

Just a quick follow-up on adding palette overrides.  The diff further
below achieves the desired effect (subject to further refinements).

We can change colour values but also colour mappings.  For example:

(setq modus-operandi-palette-overrides
      '((bg-main "#ffeedd")
        (keyword red)))

The diff:

diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el
index c7541ec..6501a6a 100644
--- a/modus-operandi-theme.el
+++ b/modus-operandi-theme.el
@@ -262,7 +262,9 @@ ;;;; Mappings
Each element has the form (NAME HEX) with the former as a
symbol and the latter as a string.")

  (modus-themes-theme modus-operandi modus-operandi-palette)
  (defvar modus-operandi-palette-overrides nil)

  (modus-themes-theme modus-operandi modus-operandi-palette modus-operandi-palette-overrides)

  (provide-theme 'modus-operandi))

diff --git a/modus-themes.el b/modus-themes.el
index 39016b0..b132b1e 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3883,17 +3934,20 @@ ;;; Theme macros
;;;; Instantiate a Modus theme

;;;###autoload
(defmacro modus-themes-theme (name palette)
(defmacro modus-themes-theme (name palette &optional overrides)
  "Bind NAME's color PALETTE around face specs and variables.
Face specifications are passed to `custom-theme-set-faces'.
While variables are handled by `custom-theme-set-variables'.
Those are stored in `modus-themes-faces' and
`modus-themes-custom-variables' respectively."
`modus-themes-custom-variables' respectively.

Optional OVERRIDES are appended to PALETTE, overriding
corresponding entries."
  (declare (indent 0))
  (let ((sym (gensym))
        (colors (mapcar #'car (symbol-value palette))))
    `(let* ((c '((class color) (min-colors 256)))
            (,sym ,palette)
            (,sym (append ,overrides ,palette))
            ,@(mapcar (lambda (color)
                        (list color
                              `(let* ((value (car (alist-get ',color ,sym))))

All the best,
Protesilaos (or simply "Prot")

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<8D1FCCEC-FEDF-4CFD-8037-CDDC8C4CF16C@gmail.com>
In-Reply-To
<87cz8vdi54.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message

/Anders Johansson

> 7 dec. 2022 kl. 04:09 skrev Protesilaos Stavrou <info@protesilaos.com>:

[…]
> 
> Hello again Anders,
> 
> Just a quick follow-up on adding palette overrides.  The diff further
> below achieves the desired effect (subject to further refinements).
> 
> We can change colour values but also colour mappings.  For example:
> 
> (setq modus-operandi-palette-overrides
>      '((bg-main "#ffeedd")
>        (keyword red)))
> 
> The diff:
> 
> diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el
> index c7541ec..6501a6a 100644
> --- a/modus-operandi-theme.el
> +++ b/modus-operandi-theme.el
> @@ -262,7 +262,9 @@ ;;;; Mappings
> Each element has the form (NAME HEX) with the former as a
> symbol and the latter as a string.")
> 
> -  (modus-themes-theme modus-operandi modus-operandi-palette)
> +  (defvar modus-operandi-palette-overrides nil)
> +
> +  (modus-themes-theme modus-operandi modus-operandi-palette modus-operandi-palette-overrides)
> 
>   (provide-theme 'modus-operandi))
> 
> diff --git a/modus-themes.el b/modus-themes.el
> index 39016b0..b132b1e 100644
> --- a/modus-themes.el
> +++ b/modus-themes.el
> @@ -3883,17 +3934,20 @@ ;;; Theme macros
> ;;;; Instantiate a Modus theme
> 
> ;;;###autoload
> -(defmacro modus-themes-theme (name palette)
> +(defmacro modus-themes-theme (name palette &optional overrides)
>   "Bind NAME's color PALETTE around face specs and variables.
> Face specifications are passed to `custom-theme-set-faces'.
> While variables are handled by `custom-theme-set-variables'.
> Those are stored in `modus-themes-faces' and
> -`modus-themes-custom-variables' respectively."
> +`modus-themes-custom-variables' respectively.
> +
> +Optional OVERRIDES are appended to PALETTE, overriding
> +corresponding entries."
>   (declare (indent 0))
>   (let ((sym (gensym))
>         (colors (mapcar #'car (symbol-value palette))))
>     `(let* ((c '((class color) (min-colors 256)))
> -            (,sym ,palette)
> +            (,sym (append ,overrides ,palette))
>             ,@(mapcar (lambda (color)
>                         (list color
>                               `(let* ((value (car (alist-get ',color ,sym))))
> 

Thank you, 
It seems like a simple enough solution where some easy recipes for customization could be provided for users (without need for the complex maintenance that I gather was becoming a problem with the earlier setup).
I will try this out sometime in the next days.

Best,
Anders Johansson
Details
Message ID
<877cz3ob9d.fsf@protesilaos.com>
In-Reply-To
<8D1FCCEC-FEDF-4CFD-8037-CDDC8C4CF16C@gmail.com> (view parent)
DKIM signature
missing
Download raw message
> From: Anders Johansson <mejlaandersj@gmail.com>
> Date: Wed,  7 Dec 2022 08:33:18 +0100
>
> /Anders Johansson
>
>> 7 dec. 2022 kl. 04:09 skrev Protesilaos Stavrou <info@protesilaos.com>:
>
> […]
>> 
>> Hello again Anders,
>> 
>> Just a quick follow-up on adding palette overrides.  The diff further
>> below achieves the desired effect (subject to further refinements).
>> 
>> We can change colour values but also colour mappings.  For example:
>> 
>> (setq modus-operandi-palette-overrides
>>      '((bg-main "#ffeedd")
>>        (keyword red)))
>> 
>> The diff:
>> 
>> [... 44 lines elided]
>
> Thank you, 

You are welcome!

> It seems like a simple enough solution where some easy recipes for
> customization could be provided for users (without need for the
> complex maintenance that I gather was becoming a problem with the
> earlier setup).  I will try this out sometime in the next days.

Indeed, this is a fairly easy approach and I will document it
thoroughly.  Wrote a blog post about it:
<https://protesilaos.com/codelog/2022-12-07-modus-themes-4-colour-values-mappings/>.

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)