branch: externals/modus-themes
commit 573db128a01e7e1ec54603de84385441fe8a00a6
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Implement "user" palette extension (common or per-theme)
---
 doc/modus-themes.info                | 326 ++++++++++++++++++++++-------------
 doc/modus-themes.org                 |  68 ++++++++
 modus-operandi-deuteranopia-theme.el |  13 ++
 modus-operandi-theme.el              |  13 ++
 modus-operandi-tinted-theme.el       |  13 ++
 modus-operandi-tritanopia-theme.el   |  13 ++
 modus-themes.el                      |  38 ++--
 modus-vivendi-deuteranopia-theme.el  |  13 ++
 modus-vivendi-theme.el               |  13 ++
 modus-vivendi-tinted-theme.el        |  13 ++
 modus-vivendi-tritanopia-theme.el    |  13 ++
 11 files changed, 401 insertions(+), 135 deletions(-)

diff --git a/doc/modus-themes.info b/doc/modus-themes.info
index f0ce6d47e6..36ef4df159 100644
--- a/doc/modus-themes.info
+++ b/doc/modus-themes.info
@@ -116,6 +116,7 @@ Customization options
 * Heading styles::               Choose among several styles, also per heading 
level
 * UI typeface::                  Toggle the use of variable-pitch across the 
User Interface
 * Palette overrides::            Refashion color values and/or semantic color 
mappings
+* Option to extend the palette for use with overrides::
 
 Use colors from the Modus themes palette
 
@@ -777,6 +778,7 @@ active, it must be reloaded for changes to take effect.
 * Heading styles::               Choose among several styles, also per heading 
level
 * UI typeface::                  Toggle the use of variable-pitch across the 
User Interface
 * Palette overrides::            Refashion color values and/or semantic color 
mappings
+* Option to extend the palette for use with overrides::
 
 
 File: modus-themes.info,  Node: Custom reload theme,  Next: Disable other 
themes,  Up: Customization options
@@ -1228,7 +1230,7 @@ items.
 for Org and others.
 
 
-File: modus-themes.info,  Node: Palette overrides,  Prev: UI typeface,  Up: 
Customization options
+File: modus-themes.info,  Node: Palette overrides,  Next: Option to extend the 
palette for use with overrides,  Prev: UI typeface,  Up: Customization options
 
 4.12 Option for palette overrides
 =================================
@@ -1345,6 +1347,65 @@ their name, such as ‘fg-removed’ which complements 
‘bg-removed’.
 watch:
 <https://protesilaos.com/codelog/2022-12-17-modus-themes-v4-demo/>.
 
+
+File: modus-themes.info,  Node: Option to extend the palette for use with 
overrides,  Prev: Palette overrides,  Up: Customization options
+
+4.13 Option to extend the palette for use with overrides
+========================================================
+
+It is possible to extend the built-in palette of each theme.  For
+example, the user may want to define their own ‘cherry’ color with a
+value of ‘#a0134f’ and then apply it as an override (*note Option for
+palette overrides: Palette overrides.).  This can be done in the form of
+a common set of definitions or on a per-theme basis.
+
+   The common values are stored in the user option
+‘modus-themes-common-palette-user’.  As for per-theme variables, we have
+the following user options:
+
+   • ‘modus-operandi-palette-user’
+
+   • ‘modus-operandi-tinted-palette-user’
+
+   • ‘modus-operandi-deuteranopia-palette-user’
+
+   • ‘modus-operandi-tritanopia-palette-user’
+
+   • ‘modus-vivendi-palette-user’
+
+   • ‘modus-vivendi-tinted-palette-user’
+
+   • ‘modus-vivendi-deuteranopia-palette-user’
+
+   • ‘modus-vivendi-tritanopia-palette-user’
+
+   Examples demonstrating how to use the aforementioned:
+
+     ;;; Common customizations
+
+     ;; Define two new colors in the common "user" palette of all the Modus 
themes.
+     (setq modus-themes-common-palette-user
+           '((cherry "#a0134f")
+             (plum "#6f459a")))
+
+     ;; Use them in the overrides.
+     (setq modus-themes-common-palette-overrides
+           '((cursor cherry)
+             (string plum)))
+
+     ;;; Per-theme customizations
+
+     ;; Define two new colors in the "user" palette of `modus-operandi'.
+     ;; Other themes will not use these.
+     (setq modus-operandi-palette-user
+           '((cherry "#a0134f")
+             (plum "#6f459a")))
+
+     ;; Use them in the overrides.
+     (setq modus-operandi-palette-overrides
+           '((cursor cherry)
+             (string plum)))
+
 
 File: modus-themes.info,  Node: Preview theme colors,  Next: Use colors from 
the Modus themes palette,  Prev: Customization options,  Up: Top
 
@@ -6178,13 +6239,23 @@ B.2 Variable index
 
 * modus-operandi-deuteranopia-palette-overrides: Palette overrides.
                                                                (line 30)
+* modus-operandi-deuteranopia-palette-user: Option to extend the palette for 
use with overrides.
+                                                               (line 20)
 * modus-operandi-palette-overrides:      Palette overrides.    (line 28)
+* modus-operandi-palette-user:           Option to extend the palette for use 
with overrides.
+                                                               (line 16)
 * modus-operandi-tinted-palette-overrides: Palette overrides.  (line 32)
+* modus-operandi-tinted-palette-user:    Option to extend the palette for use 
with overrides.
+                                                               (line 18)
 * modus-operandi-tritanopia-palette-overrides: Palette overrides.
                                                                (line 34)
+* modus-operandi-tritanopia-palette-user: Option to extend the palette for use 
with overrides.
+                                                               (line 22)
 * modus-themes-after-load-theme-hook:    Enable and load.      (line 85)
 * modus-themes-bold-constructs:          Bold constructs.      (line  6)
 * modus-themes-common-palette-overrides: Palette overrides.    (line 22)
+* modus-themes-common-palette-user:      Option to extend the palette for use 
with overrides.
+                                                               (line 12)
 * modus-themes-completions:              Completion UIs.       (line  6)
 * modus-themes-custom-auto-reload:       Custom reload theme.  (line  6)
 * modus-themes-disable-other-themes:     Disable other themes. (line  6)
@@ -6207,10 +6278,18 @@ B.2 Variable index
 * modus-themes-variable-pitch-ui:        UI typeface.          (line  6)
 * modus-vivendi-deuteranopia-palette-overrides: Palette overrides.
                                                                (line 38)
+* modus-vivendi-deuteranopia-palette-user: Option to extend the palette for 
use with overrides.
+                                                               (line 28)
 * modus-vivendi-palette-overrides:       Palette overrides.    (line 36)
+* modus-vivendi-palette-user:            Option to extend the palette for use 
with overrides.
+                                                               (line 24)
 * modus-vivendi-tinted-palette-overrides: Palette overrides.   (line 40)
+* modus-vivendi-tinted-palette-user:     Option to extend the palette for use 
with overrides.
+                                                               (line 26)
 * modus-vivendi-tritanopia-palette-overrides: Palette overrides.
                                                                (line 42)
+* modus-vivendi-tritanopia-palette-user: Option to extend the palette for use 
with overrides.
+                                                               (line 30)
 
 
 File: modus-themes.info,  Node: Concept index,  Prev: Variable index,  Up: 
Indices
@@ -6283,128 +6362,129 @@ B.3 Concept index
 
 Tag Table:
 Node: Top872
-Node: Overview8413
-Node: How do the themes look like11185
-Node: Learn about the latest changes11544
-Node: Installation11932
-Node: Install manually from source12862
-Node: Install from the archives13687
-Node: Install on GNU/Linux14286
-Node: Debian 11 Bullseye14779
-Node: GNU Guix15189
-Node: Dealing with byte compilation errors15472
-Node: Enable and load16630
-Node: The require-theme for built-in Emacs themes20574
-Node: Sample configuration with and without use-package21694
-Node: Differences between loading and enabling24542
-Node: Customization options26674
-Node: Custom reload theme30458
-Node: Disable other themes31378
-Node: Bold constructs32620
-Node: Italic constructs33492
-Node: Option for which themes to toggle34320
-Node: Mixed fonts35095
-Node: Command prompts36149
-Node: Completion UIs37992
-Node: Org mode blocks40843
-Node: Heading styles41486
-Node: UI typeface45916
-Node: Palette overrides46889
-Node: Preview theme colors51253
-Node: Use colors from the Modus themes palette53066
-Node: Get a single color from the palette with 
modus-themes-get-color-value53930
-Node: Use theme colors in code with modus-themes-with-colors56292
-Node: Advanced customization58548
-Node: DIY Palette override presets60207
-Node: DIY Stylistic variants using palette overrides63062
-Node: DIY Make the mode line borderless65116
-Node: DIY Make the active mode line colorful66491
-Node: DIY Make the tab bar more or less colorful68709
-Node: DIY Make the fringe invisible or another color70646
-Node: DIY Make links use subtle or no underlines71847
-Node: DIY Make prompts more or less colorful72965
-Node: DIY Make completion matches more or less colorful74288
-Node: DIY Make comments yellow and strings green77847
-Node: DIY Make code syntax use the old alt-syntax style79556
-Node: DIY Make use of alternative styles for code syntax82679
-Node: DIY Make matching parenthesis more or less intense86141
-Node: DIY Make box buttons more or less gray87513
-Node: DIY Make TODO and DONE more or less intense88526
-Node: DIY Make headings more or less colorful90027
-Node: DIY Make Org block colors more or less colorful92144
-Node: DIY Make Org agenda more or less colorful96518
-Node: DIY Make inline code in prose use alternative styles99693
-Node: DIY Make mail citations and headers more or less colorful101935
-Node: DIY Make the region preserve text colors plus other styles104335
-Node: DIY Make mouse highlights more or less colorful105891
-Node: DIY Make language underlines less colorful106904
-Node: DIY Make line numbers use alternative styles108056
-Node: DIY Make diffs use only a foreground109699
-Node: DIY Make deuteranopia diffs red and blue instead of yellow and 
blue112590
-Node: DIY More accurate colors in terminal emulators115070
-Node: DIY Range of color with terminal emulators116382
-Node: DIY Per-theme customization settings119175
-Node: DIY Do not extend the region background120608
-Node: DIY Add padding to the mode line121412
-Node: DIY Remap face with local value124345
-Node: DIY Font configurations for Org and others126893
-Ref: DIY Font configurations for Org and others-Footnote-1129876
-Node: DIY Configure bold and italic faces130063
-Node: DIY Custom Org todo keyword and priority faces134685
-Node: DIY Custom Org emphasis faces138428
-Node: DIY Use colored Org source blocks per language143309
-Node: DIY Measure color contrast147949
-Node: DIY Load theme depending on time of day150669
-Node: DIY Backdrop for pdf-tools151699
-Node: DIY Toggle themes without reloading them154868
-Node: DIY Use more spacious margins or padding in Emacs frames156177
-Node: DIY Custom hl-todo colors160434
-Node: DIY Add support for solaire-mode162251
-Node: DIY Use a hook at the post-load-theme phase165377
-Node: DIY A theme-agnostic hook for theme loading167501
-Node: Face coverage170132
-Node: Supported packages170584
-Node: Indirectly covered packages176315
-Node: Notes on individual packages177684
-Node: Note on calendarel weekday and weekend colors178784
-Node: Note on git-gutter in Doom Emacs179932
-Node: Note on php-mode multiline comments182432
-Node: Note on underlines in compilation buffers183192
-Node: Note on inline Latex in Org buffers184064
-Node: Note on dimmerel184674
-Node: Note on display-fill-column-indicator-mode186159
-Node: Note on highlight-parenthesesel187612
-Node: Note on mmm-modeel background colors193695
-Node: Note for prism196049
-Node: Note on company-mode overlay pop-up199271
-Ref: Note on company-mode overlay pop-up-Footnote-1200001
-Ref: Note on company-mode overlay pop-up-Footnote-2200068
-Node: Note on ERC escaped color sequences200123
-Ref: Note on ERC escaped color sequences-Footnote-1201551
-Node: Note on powerline or spaceline201661
-Node: Note on SHR colors202075
-Node: Note on SHR fonts202499
-Node: Note on Ement colors and fonts203186
-Node: Note on pdf-tools link hints204696
-Node: Note on the Notmuch logo207156
-Node: Note on goto-address-mode faces207694
-Node: Frequently Asked Questions208812
-Node: Is the contrast ratio about adjacent colors?209445
-Node: What does it mean to avoid exaggerations?210954
-Node: Why are colors mostly variants of blue magenta cyan?212806
-Node: What is the best setup for legibility?217140
-Node: Are these color schemes?219787
-Node: Port the Modus themes to other platforms?223471
-Node: Contributing226317
-Node: Sources of the themes226716
-Node: Issues you can help with227612
-Node: Patches require copyright assignment to the FSF229005
-Node: Acknowledgements231227
-Node: GNU Free Documentation License235465
-Node: Indices260829
-Node: Function index261008
-Node: Variable index262306
-Node: Concept index265000
+Node: Overview8469
+Node: How do the themes look like11241
+Node: Learn about the latest changes11600
+Node: Installation11988
+Node: Install manually from source12918
+Node: Install from the archives13743
+Node: Install on GNU/Linux14342
+Node: Debian 11 Bullseye14835
+Node: GNU Guix15245
+Node: Dealing with byte compilation errors15528
+Node: Enable and load16686
+Node: The require-theme for built-in Emacs themes20630
+Node: Sample configuration with and without use-package21750
+Node: Differences between loading and enabling24598
+Node: Customization options26730
+Node: Custom reload theme30570
+Node: Disable other themes31490
+Node: Bold constructs32732
+Node: Italic constructs33604
+Node: Option for which themes to toggle34432
+Node: Mixed fonts35207
+Node: Command prompts36261
+Node: Completion UIs38104
+Node: Org mode blocks40955
+Node: Heading styles41598
+Node: UI typeface46028
+Node: Palette overrides47001
+Node: Option to extend the palette for use with overrides51425
+Node: Preview theme colors53389
+Node: Use colors from the Modus themes palette55202
+Node: Get a single color from the palette with 
modus-themes-get-color-value56066
+Node: Use theme colors in code with modus-themes-with-colors58428
+Node: Advanced customization60684
+Node: DIY Palette override presets62343
+Node: DIY Stylistic variants using palette overrides65198
+Node: DIY Make the mode line borderless67252
+Node: DIY Make the active mode line colorful68627
+Node: DIY Make the tab bar more or less colorful70845
+Node: DIY Make the fringe invisible or another color72782
+Node: DIY Make links use subtle or no underlines73983
+Node: DIY Make prompts more or less colorful75101
+Node: DIY Make completion matches more or less colorful76424
+Node: DIY Make comments yellow and strings green79983
+Node: DIY Make code syntax use the old alt-syntax style81692
+Node: DIY Make use of alternative styles for code syntax84815
+Node: DIY Make matching parenthesis more or less intense88277
+Node: DIY Make box buttons more or less gray89649
+Node: DIY Make TODO and DONE more or less intense90662
+Node: DIY Make headings more or less colorful92163
+Node: DIY Make Org block colors more or less colorful94280
+Node: DIY Make Org agenda more or less colorful98654
+Node: DIY Make inline code in prose use alternative styles101829
+Node: DIY Make mail citations and headers more or less colorful104071
+Node: DIY Make the region preserve text colors plus other styles106471
+Node: DIY Make mouse highlights more or less colorful108027
+Node: DIY Make language underlines less colorful109040
+Node: DIY Make line numbers use alternative styles110192
+Node: DIY Make diffs use only a foreground111835
+Node: DIY Make deuteranopia diffs red and blue instead of yellow and 
blue114726
+Node: DIY More accurate colors in terminal emulators117206
+Node: DIY Range of color with terminal emulators118518
+Node: DIY Per-theme customization settings121311
+Node: DIY Do not extend the region background122744
+Node: DIY Add padding to the mode line123548
+Node: DIY Remap face with local value126481
+Node: DIY Font configurations for Org and others129029
+Ref: DIY Font configurations for Org and others-Footnote-1132012
+Node: DIY Configure bold and italic faces132199
+Node: DIY Custom Org todo keyword and priority faces136821
+Node: DIY Custom Org emphasis faces140564
+Node: DIY Use colored Org source blocks per language145445
+Node: DIY Measure color contrast150085
+Node: DIY Load theme depending on time of day152805
+Node: DIY Backdrop for pdf-tools153835
+Node: DIY Toggle themes without reloading them157004
+Node: DIY Use more spacious margins or padding in Emacs frames158313
+Node: DIY Custom hl-todo colors162570
+Node: DIY Add support for solaire-mode164387
+Node: DIY Use a hook at the post-load-theme phase167513
+Node: DIY A theme-agnostic hook for theme loading169637
+Node: Face coverage172268
+Node: Supported packages172720
+Node: Indirectly covered packages178451
+Node: Notes on individual packages179820
+Node: Note on calendarel weekday and weekend colors180920
+Node: Note on git-gutter in Doom Emacs182068
+Node: Note on php-mode multiline comments184568
+Node: Note on underlines in compilation buffers185328
+Node: Note on inline Latex in Org buffers186200
+Node: Note on dimmerel186810
+Node: Note on display-fill-column-indicator-mode188295
+Node: Note on highlight-parenthesesel189748
+Node: Note on mmm-modeel background colors195831
+Node: Note for prism198185
+Node: Note on company-mode overlay pop-up201407
+Ref: Note on company-mode overlay pop-up-Footnote-1202137
+Ref: Note on company-mode overlay pop-up-Footnote-2202204
+Node: Note on ERC escaped color sequences202259
+Ref: Note on ERC escaped color sequences-Footnote-1203687
+Node: Note on powerline or spaceline203797
+Node: Note on SHR colors204211
+Node: Note on SHR fonts204635
+Node: Note on Ement colors and fonts205322
+Node: Note on pdf-tools link hints206832
+Node: Note on the Notmuch logo209292
+Node: Note on goto-address-mode faces209830
+Node: Frequently Asked Questions210948
+Node: Is the contrast ratio about adjacent colors?211581
+Node: What does it mean to avoid exaggerations?213090
+Node: Why are colors mostly variants of blue magenta cyan?214942
+Node: What is the best setup for legibility?219276
+Node: Are these color schemes?221923
+Node: Port the Modus themes to other platforms?225607
+Node: Contributing228453
+Node: Sources of the themes228852
+Node: Issues you can help with229748
+Node: Patches require copyright assignment to the FSF231141
+Node: Acknowledgements233363
+Node: GNU Free Documentation License237601
+Node: Indices262965
+Node: Function index263144
+Node: Variable index264442
+Node: Concept index268645
 
 End Tag Table
 
diff --git a/doc/modus-themes.org b/doc/modus-themes.org
index e7d104842d..78dbf3dc70 100644
--- a/doc/modus-themes.org
+++ b/doc/modus-themes.org
@@ -1190,6 +1190,74 @@ Named colors can be previewed, such as with the command
 For a video tutorial that users of all skill levels can approach,
 watch: https://protesilaos.com/codelog/2022-12-17-modus-themes-v4-demo/.
 
+** Option to extend the palette for use with overrides
+:PROPERTIES:
+:CUSTOM_ID: h:287fb971-a866-4d88-9993-56e902dd63c4
+:END:
+
+It is possible to extend the built-in palette of each theme. For
+example, the user may want to define their own =cherry= color with
+a value of =#a0134f= and then apply it as an override 
([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]).
+This can be done in the form of a common set of definitions or on a
+per-theme basis.
+
+#+vindex: modus-themes-common-palette-user
+The common values are stored in the user option 
~modus-themes-common-palette-user~.
+As for per-theme variables, we have the following user options:
+
+#+vindex: modus-operandi-palette-user
+- ~modus-operandi-palette-user~
+
+#+vindex: modus-operandi-tinted-palette-user
+- ~modus-operandi-tinted-palette-user~
+
+#+vindex: modus-operandi-deuteranopia-palette-user
+- ~modus-operandi-deuteranopia-palette-user~
+
+#+vindex: modus-operandi-tritanopia-palette-user
+- ~modus-operandi-tritanopia-palette-user~
+
+#+vindex: modus-vivendi-palette-user
+- ~modus-vivendi-palette-user~
+
+#+vindex: modus-vivendi-tinted-palette-user
+- ~modus-vivendi-tinted-palette-user~
+
+#+vindex: modus-vivendi-deuteranopia-palette-user
+- ~modus-vivendi-deuteranopia-palette-user~
+
+#+vindex: modus-vivendi-tritanopia-palette-user
+- ~modus-vivendi-tritanopia-palette-user~
+
+Examples demonstrating how to use the aforementioned:
+
+#+begin_src emacs-lisp
+;;; Common customizations
+
+;; Define two new colors in the common "user" palette of all the Modus themes.
+(setq modus-themes-common-palette-user
+      '((cherry "#a0134f")
+        (plum "#6f459a")))
+
+;; Use them in the overrides.
+(setq modus-themes-common-palette-overrides
+      '((cursor cherry)
+        (string plum)))
+
+;;; Per-theme customizations
+
+;; Define two new colors in the "user" palette of `modus-operandi'.
+;; Other themes will not use these.
+(setq modus-operandi-palette-user
+      '((cherry "#a0134f")
+        (plum "#6f459a")))
+
+;; Use them in the overrides.
+(setq modus-operandi-palette-overrides
+      '((cursor cherry)
+        (string plum)))
+#+end_src
+
 * Preview theme colors
 :properties:
 :custom_id: h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d
diff --git a/modus-operandi-deuteranopia-theme.el 
b/modus-operandi-deuteranopia-theme.el
index 996ad07897..286ec33bbd 100644
--- a/modus-operandi-deuteranopia-theme.el
+++ b/modus-operandi-deuteranopia-theme.el
@@ -491,6 +491,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-operandi-deuteranopia-palette-user nil
+    "Like the `modus-operandi-deuteranopia-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-operandi-deuteranopia-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-operandi-deuteranopia-palette-overrides nil
     "Overrides for `modus-operandi-deuteranopia-palette'.
 
diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el
index 9d11f495d5..065d06c6fa 100644
--- a/modus-operandi-theme.el
+++ b/modus-operandi-theme.el
@@ -489,6 +489,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-operandi-palette-user nil
+    "Like the `modus-operandi-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-operandi-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-operandi-palette-overrides nil
     "Overrides for `modus-operandi-palette'.
 
diff --git a/modus-operandi-tinted-theme.el b/modus-operandi-tinted-theme.el
index 0d62f737fc..f926f1dc88 100644
--- a/modus-operandi-tinted-theme.el
+++ b/modus-operandi-tinted-theme.el
@@ -489,6 +489,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-operandi-tinted-palette-user nil
+    "Like the `modus-operandi-tinted-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-operandi-tinted-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-operandi-tinted-palette-overrides nil
     "Overrides for `modus-operandi-tinted-palette'.
 
diff --git a/modus-operandi-tritanopia-theme.el 
b/modus-operandi-tritanopia-theme.el
index 9427723346..63d79cb908 100644
--- a/modus-operandi-tritanopia-theme.el
+++ b/modus-operandi-tritanopia-theme.el
@@ -491,6 +491,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-operandi-tritanopia-palette-user nil
+    "Like the `modus-operandi-tritanopia-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-operandi-tritanopia-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-operandi-tritanopia-palette-overrides nil
     "Overrides for `modus-operandi-tritanopia-palette'.
 
diff --git a/modus-themes.el b/modus-themes.el
index 15f828f083..cdf9a257c9 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -641,6 +641,20 @@ In user configuration files the form may look like this:
   :initialize #'custom-initialize-default
   :link '(info-link "(modus-themes) Command prompts"))
 
+
+(defcustom modus-themes-common-palette-user nil
+  "Common user-defined colors to extend all the themes' palettes.
+This is meant to extend the palette of the active Modus theme with
+custom named colors and/or semantic palette mappings.  Those may then be
+used in combination with palette overrides (see
+`modus-themes-common-palette-overrides')."
+  :group 'modus-themes
+  :package-version '(modus-themes . "4.5.0")
+  :type '(repeat (list symbol (choice symbol string)))
+  :set #'modus-themes--set-option
+  :initialize #'custom-initialize-default
+  :link '(info-link "(modus-themes) Extend the palette for use with 
overrides"))
+
 (defcustom modus-themes-common-palette-overrides nil
   "Set palette overrides for all the Modus themes.
 
@@ -1068,22 +1082,22 @@ C1 and C2 are color values written in hexadecimal RGB."
   (car (or (modus-themes--list-enabled-themes)
            (modus-themes--list-known-themes))))
 
-(defun modus-themes--palette-symbol (theme &optional overrides)
-  "Return THEME palette as a symbol.
-With optional OVERRIDES, return THEME palette overrides as a
-symbol."
-  (when-let ((suffix (cond
-                      ((and theme overrides)
-                       "palette-overrides")
-                      (theme
-                       "palette"))))
-    (intern (format "%s-%s" theme suffix))))
+(defun modus-themes--palette-symbol (theme &optional suffix)
+  "Return THEME palette as a symbol of the form THEME-palette.
+With optional SUFFIX, return THEME-palette-SUFFIX as a symbol."
+  (when theme
+    (intern
+     (if suffix
+         (format "%s-palette-%s" theme suffix)
+       (format "%s-palette" theme)))))
 
 (defun modus-themes--palette-value (theme &optional overrides)
   "Return palette value of THEME with optional OVERRIDES."
-  (let ((base-value (symbol-value (modus-themes--palette-symbol theme))))
+  (let* ((core-palette (symbol-value (modus-themes--palette-symbol theme)))
+         (user-palette (symbol-value (modus-themes--palette-symbol theme 
"user")))
+         (base-value (append modus-themes-common-palette-user user-palette 
core-palette)))
     (if overrides
-        (append (symbol-value (modus-themes--palette-symbol theme :overrides))
+        (append (symbol-value (modus-themes--palette-symbol theme "overrides"))
                 modus-themes-common-palette-overrides
                 base-value)
       base-value)))
diff --git a/modus-vivendi-deuteranopia-theme.el 
b/modus-vivendi-deuteranopia-theme.el
index d5cb0a5bd6..9b42996403 100644
--- a/modus-vivendi-deuteranopia-theme.el
+++ b/modus-vivendi-deuteranopia-theme.el
@@ -491,6 +491,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-vivendi-deuteranopia-palette-user nil
+    "Like the `modus-vivendi-deuteranopia-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-vivendi-deuteranopia-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-vivendi-deuteranopia-palette-overrides nil
     "Overrides for `modus-vivendi-deuteranopia-palette'.
 
diff --git a/modus-vivendi-theme.el b/modus-vivendi-theme.el
index 688b873546..04be3e1299 100644
--- a/modus-vivendi-theme.el
+++ b/modus-vivendi-theme.el
@@ -489,6 +489,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-vivendi-palette-user nil
+    "Like the `modus-vivendi--palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-vivendi--palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-vivendi-palette-overrides nil
     "Overrides for `modus-vivendi-palette'.
 
diff --git a/modus-vivendi-tinted-theme.el b/modus-vivendi-tinted-theme.el
index 4f40274a8d..9399f3df48 100644
--- a/modus-vivendi-tinted-theme.el
+++ b/modus-vivendi-tinted-theme.el
@@ -489,6 +489,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-vivendi-tinted-palette-user nil
+    "Like the `modus-vivendi-tinted-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-vivendi-tinted-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-vivendi-tinted-palette-overrides nil
     "Overrides for `modus-vivendi-tinted-palette'.
 
diff --git a/modus-vivendi-tritanopia-theme.el 
b/modus-vivendi-tritanopia-theme.el
index 0b727809d5..9fb5ac65c4 100644
--- a/modus-vivendi-tritanopia-theme.el
+++ b/modus-vivendi-tritanopia-theme.el
@@ -491,6 +491,19 @@ Semantic color mappings have the form (MAPPING-NAME 
COLOR-NAME)
 with both as symbols.  The latter is a named color that already
 exists in the palette and is associated with a HEX-VALUE.")
 
+  (defcustom modus-vivendi-tritanopia-palette-user nil
+    "Like the `modus-vivendi-tritanopia-palette' for user-defined entries.
+This is meant to extend the palette with custom named colors and/or
+semantic palette mappings.  Those may then be used in combination with
+palette overrides (also see `modus-themes-common-palette-overrides' and
+`modus-vivendi-tritanopia-palette-overrides')."
+    :group 'modus-themes
+    :package-version '(modus-themes . "4.5.0")
+    :type '(repeat (list symbol (choice symbol string)))
+    :set #'modus-themes--set-option
+    :initialize #'custom-initialize-default
+    :link '(info-link "(modus-themes) Option to extend the palette for use 
with overrides"))
+
   (defcustom modus-vivendi-tritanopia-palette-overrides nil
     "Overrides for `modus-vivendi-tritanopia-palette'.
 

Reply via email to