-
Notifications
You must be signed in to change notification settings - Fork 31
/
modus-themes.el
4336 lines (4066 loc) · 215 KB
/
modus-themes.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; modus-themes.el --- Elegant, highly legible and customizable themes -*- lexical-binding:t -*-
;; Copyright (C) 2019-2024 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://github.com/protesilaos/modus-themes
;; Version: 4.6.0
;; Package-Requires: ((emacs "28.1"))
;; Keywords: faces, theme, accessibility
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; The Modus themes conform with the highest standard for
;; color-contrast accessibility between background and foreground
;; values (WCAG AAA). Please refer to the official Info manual for
;; further documentation (distributed with the themes, or available
;; at: <https://protesilaos.com/emacs/modus-themes>).
;;; Code:
(eval-when-compile (require 'subr-x))
(defgroup modus-themes ()
"User options for the Modus themes.
The Modus themes conform with the WCAG AAA standard for color
contrast between background and foreground combinations (a
minimum contrast of 7:1---the highest standard of its kind).
The Modus themes collection includes themes that are optimized
for people with red-green or blue-yellow color
deficiency (deuteranopia or tritanopia, respectively)."
:group 'faces
:link '(info-link "(modus-themes) Top")
:link '(url-link :tag "Homepage" "https://protesilaos.com/emacs/modus-themes")
:link '(url-link :tag "Sample pictures" "https://protesilaos.com/emacs/modus-themes-pictures")
:prefix "modus-themes-"
:tag "Modus Themes")
(defgroup modus-themes-faces ()
"Faces defined by the Modus themes."
:group 'modus-themes
:link '(info-link "(modus-themes) Top")
:link '(url-link :tag "Homepage" "https://protesilaos.com/emacs/modus-themes")
:link '(url-link :tag "Sample pictures" "https://protesilaos.com/emacs/modus-themes-pictures")
:prefix "modus-themes-"
:tag "Modus Themes Faces")
;;;; Custom faces
;; These faces are used internally to ensure consistency between various
;; groups and to streamline the evaluation of relevant customization
;; options.
(dolist (color '( red green blue yellow magenta cyan
red-warmer green-warmer blue-warmer yellow-warmer magenta-warmer cyan-warmer
red-cooler green-cooler blue-cooler yellow-cooler magenta-cooler cyan-cooler
red-faint green-faint blue-faint yellow-faint magenta-faint cyan-faint
red-intense green-intense blue-intense yellow-intense magenta-intense cyan-intense))
(custom-declare-face
(intern (format "modus-themes-fg-%s" color))
nil (format "Face with %s foreground." color)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (color '(red green yellow blue magenta cyan))
(custom-declare-face
(intern (format "modus-themes-nuanced-%s" color))
nil (format "Nuanced %s background." color)
:package-version '(modus-themes . "4.1.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (color '(red green yellow blue magenta cyan))
(custom-declare-face
(intern (format "modus-themes-subtle-%s" color))
nil (format "Subtle %s background." color)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (color '(red green yellow blue magenta cyan))
(custom-declare-face
(intern (format "modus-themes-intense-%s" color))
nil (format "Intense %s background." color)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (scope '(alt del sel))
(custom-declare-face
(intern (format "modus-themes-mark-%s" scope))
nil (format "Mark of type %s." scope)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (scope '(note warning error))
(custom-declare-face
(intern (format "modus-themes-lang-%s" scope))
nil (format "Linter or spell check of type %s." scope)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (scope '(note warning error))
(custom-declare-face
(intern (format "modus-themes-prominent-%s" scope))
nil (format "Prominent notification of type %s." scope)
:package-version '(modus-themes . "4.2.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (scope '(current lazy replace))
(custom-declare-face
(intern (format "modus-themes-search-%s" scope))
nil (format "Search of type %s." scope)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dotimes (n 4)
(custom-declare-face
(intern (format "modus-themes-search-rx-group-%s" n))
nil (format "Search regexp group number %s." n)
:package-version '(modus-themes . "4.4.0")
:version "30.1"
:group 'modus-themes-faces))
(dolist (scope '(code macro verbatim))
(custom-declare-face
(intern (format "modus-themes-prose-%s" scope))
nil (format "Construct of type %s for prose." scope)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(dotimes (n 9)
(custom-declare-face
(intern (format "modus-themes-heading-%d" n))
nil (format "Level %d heading." n)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
(defface modus-themes-bold nil
"Generic face for applying a conditional bold weight.
This behaves in accordance with `modus-themes-bold-constructs'."
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces)
(defface modus-themes-slant nil
"Generic face for applying a conditional slant (italics).
This behaves in accordance with `modus-themes-italic-constructs'."
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces)
(defface modus-themes-key-binding nil
"Face for key bindings."
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces)
(defface modus-themes-fixed-pitch nil
"Face for `fixed-pitch' if `modus-themes-mixed-fonts' is non-nil."
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces)
(defface modus-themes-ui-variable-pitch nil
"Face for `variable-pitch' if `modus-themes-variable-pitch-ui' is non-nil."
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces)
(defface modus-themes-reset-soft nil
"Generic face to set most face properties to nil.
This is intended to be inherited by faces that should not retain
properties from their context (e.g. an overlay over an underlined
text should not be underlined as well) yet still blend in."
:group 'modus-themes-faces)
(defface modus-themes-prompt nil
"Generic face for command prompts."
:group 'modus-themes-faces)
(defface modus-themes-completion-selected nil
"Face for current selection in completion UIs."
:group 'modus-themes-faces)
(defface modus-themes-button nil
"Face for graphical buttons."
:group 'modus-themes-faces)
(dotimes (n 4)
(custom-declare-face
(intern (format "modus-themes-completion-match-%d" n))
nil (format "Completions match level %d." n)
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes-faces))
;;;; Customization variables
(defcustom modus-themes-custom-auto-reload t
"Automatically reload theme after setting options with Customize.
All theme user options take effect when a theme is loaded. Any
subsequent changes require the theme to be reloaded.
When this variable has a non-nil value, any change made via the
Custom UI or related functions such as `customize-set-variable'
and `setopt' (Emacs 29), will trigger a reload automatically.
With a nil value, changes to user options have no further
consequences. The user must manually reload the theme."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type 'boolean
:link '(info-link "(modus-themes) Custom reload theme"))
(defun modus-themes--set-option (sym val)
"Custom setter for theme related user options.
Will set SYM to VAL, and reload the current theme, unless
`modus-themes-custom-auto-reload' is nil."
(set-default sym val)
(when (and modus-themes-custom-auto-reload
;; Check if a theme is being loaded, in which case we
;; don't want to reload a theme if the setter is
;; invoked. `custom--inhibit-theme-enable' is set to nil
;; by `enable-theme'.
(bound-and-true-p custom--inhibit-theme-enable))
(when-let* ((modus-themes-custom-auto-reload t)
(theme (modus-themes--current-theme)))
(modus-themes-load-theme theme))))
(defcustom modus-themes-disable-other-themes t
"Disable all other themes when loading a Modus theme.
When the value is non-nil, the commands `modus-themes-toggle' and
`modus-themes-select', as well as the `modus-themes-load-theme'
function, will disable all other themes while loading the
specified Modus theme. This is done to ensure that Emacs does
not blend two or more themes: such blends lead to awkward results
that undermine the work of the designer.
When the value is nil, the aforementioned commands and function
will only disable other themes within the Modus collection.
This option is provided because Emacs themes are not necessarily
limited to colors/faces: they can consist of an arbitrary set of
customizations. Users who use such customization bundles must
set this variable to a nil value."
:group 'modus-themes
:package-version '(modus-themes . "4.1.0")
:version "30.1"
:type 'boolean
:link '(info-link "(modus-themes) Disable other themes"))
(defvaralias 'modus-themes-collection 'modus-themes-items
"Alias of `modus-themes-items'.")
(defconst modus-themes-items
'( modus-operandi
modus-operandi-tinted
modus-operandi-deuteranopia
modus-operandi-tritanopia
modus-vivendi
modus-vivendi-tinted
modus-vivendi-deuteranopia
modus-vivendi-tritanopia)
"Symbols of the Modus themes.")
(defcustom modus-themes-to-toggle '(modus-operandi modus-vivendi)
"Specify two Modus themes for `modus-themes-toggle' command.
The variable `modus-themes-items' contains the symbols of all
official themes that form part of this collection.
The default value of this user option includes the original
themes: `modus-operandi' (light) and `modus-vivendi' (dark).
If the value is nil or otherwise does not specify two valid Modus
themes, the command `modus-themes-toggle' reverts to selecting a
theme from the list of available Modus themes. In effect, it is
the same as using the command `modus-themes-select'."
:type `(choice
(const :tag "No toggle" nil)
(list :tag "Pick two themes to toggle between"
(choice :tag "Theme one of two" ,@(mapcar (lambda (theme) (list 'const theme)) modus-themes-items))
(choice :tag "Theme two of two" ,@(mapcar (lambda (theme) (list 'const theme)) modus-themes-items))))
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes)
(defcustom modus-themes-to-rotate modus-themes-items
"List of Modus themes to rotate among, per `modus-themes-rotate'."
:type `(repeat
(choice :tag "A theme among the `modus-themes-items'"
,@(mapcar (lambda (theme) (list 'const theme)) modus-themes-items)))
:package-version '(modus-themes . "4.6.0")
:version "31.1"
:group 'modus-themes)
(defvaralias 'modus-themes-post-load-hook 'modus-themes-after-load-theme-hook
"Alias for `modus-themes-after-load-theme-hook'.")
(defcustom modus-themes-after-load-theme-hook nil
"Hook that runs after loading a Modus theme.
This is used by the command `modus-themes-toggle'."
:type 'hook
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:group 'modus-themes)
(defvaralias 'modus-themes-slanted-constructs 'modus-themes-italic-constructs)
(defcustom modus-themes-italic-constructs nil
"Use italic font forms in more code constructs."
:group 'modus-themes
:package-version '(modus-themes . "1.5.0")
:version "28.1"
:type 'boolean
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) Italic constructs"))
(defcustom modus-themes-bold-constructs nil
"Use bold text in more code constructs."
:group 'modus-themes
:package-version '(modus-themes . "1.0.0")
:version "28.1"
:type 'boolean
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) Bold constructs"))
(defcustom modus-themes-variable-pitch-ui nil
"Use proportional fonts (variable-pitch) in UI elements.
This includes the mode line, header line, tab bar, and tab line."
:group 'modus-themes
:package-version '(modus-themes . "1.1.0")
:version "28.1"
:type 'boolean
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) UI typeface"))
(defcustom modus-themes-mixed-fonts nil
"Non-nil to enable inheritance from `fixed-pitch' in some faces.
This is done to allow spacing-sensitive constructs, such as Org
tables and code blocks, to remain monospaced when users opt for
something like the command `variable-pitch-mode'.
Users may need to explicitly configure the font family of
`fixed-pitch' in order to get a consistent experience with their
typography (also check the `fontaine' package on GNU ELPA (by
Protesilaos))."
:group 'modus-themes
:package-version '(modus-themes . "1.7.0")
:version "29.1"
:type 'boolean
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) Mixed fonts"))
(defconst modus-themes--weight-widget
'(choice :tag "Font weight (must be supported by the typeface)"
(const :tag "Unspecified (use whatever the default is)" nil)
(const :tag "Thin" thin)
(const :tag "Ultra-light" ultralight)
(const :tag "Extra-light" extralight)
(const :tag "Light" light)
(const :tag "Semi-light" semilight)
(const :tag "Regular" regular)
(const :tag "Medium" medium)
(const :tag "Semi-bold" semibold)
(const :tag "Bold" bold)
(const :tag "Extra-bold" extrabold)
(const :tag "Ultra-bold" ultrabold))
"List of supported font weights used by `defcustom' forms.")
(defconst modus-themes--headings-widget
`(set :tag "Properties" :greedy t
(const :tag "Proportionately spaced font (variable-pitch)" variable-pitch)
,modus-themes--weight-widget
(radio :tag "Height"
(float :tag "Floating point to adjust height by")
(cons :tag "Cons cell of `(height . FLOAT)'"
(const :tag "The `height' key (constant)" height)
(float :tag "Floating point"))))
"Refer to the doc string of `modus-themes-headings'.
This is a helper variable intended for internal use.")
(defcustom modus-themes-headings nil
"Heading styles with optional list of values per heading level.
This is an alist that accepts a (KEY . LIST-OF-VALUES)
combination. The KEY is either a number, representing the
heading's level (0-8) or t, which pertains to the fallback style.
The named keys `agenda-date' and `agenda-structure' apply to the
Org agenda.
Level 0 is used for what counts as a document title or
equivalent, such as the #+title construct we find in Org files.
Levels 1-8 are regular headings.
The LIST-OF-VALUES covers symbols that refer to properties, as
described below. Here is a complete sample with various
stylistic combinations, followed by a presentation of all
available properties:
(setq modus-themes-headings
(quote ((1 . (variable-pitch 1.5))
(2 . (1.3))
(agenda-date . (1.3))
(agenda-structure . (variable-pitch light 1.8))
(t . (1.1)))))
By default (a nil value for this variable), all headings have a
bold typographic weight, use a desaturated text color, have a
font family that is the same as the `default' face (typically
monospaced), and a height that is equal to the `default' face's
height.
A `variable-pitch' property changes the font family of the
heading to that of the `variable-pitch' face (normally a
proportionately spaced typeface).
The symbol of a weight attribute adjusts the font of the heading
accordingly, such as `light', `semibold', etc. Valid symbols are
defined in the variable `modus-themes-weights'. The absence of a
weight means that bold will be used by virtue of inheriting the
`bold' face (check the manual for tweaking bold and italic
faces).
A number, expressed as a floating point (e.g. 1.5), adjusts the
height of the heading to that many times the base font size. The
default height is the same as 1.0, though it need not be
explicitly stated. Instead of a floating point, an acceptable
value can be in the form of a cons cell like (height . FLOAT)
or (height FLOAT), where FLOAT is the given number.
Combinations of any of those properties are expressed as a list,
like in these examples:
(semibold)
(variable-pitch semibold 1.3)
(variable-pitch semibold (height 1.3)) ; same as above
(variable-pitch semibold (height . 1.3)) ; same as above
The order in which the properties are set is not significant.
In user configuration files the form may look like this:
(setq modus-themes-headings
(quote ((1 . (variable-pitch 1.5))
(2 . (1.3))
(agenda-date . (1.3))
(agenda-structure . (variable-pitch light 1.8))
(t . (1.1)))))
When defining the styles per heading level, it is possible to
pass a non-nil value (t) instead of a list of properties. This
will retain the original aesthetic for that level. For example:
(setq modus-themes-headings
(quote ((1 . t) ; keep the default style
(2 . (semibold 1.2))
(t . (variable-pitch))))) ; style for all other headings
(setq modus-themes-headings
(quote ((1 . (variable-pitch extrabold 1.5))
(2 . (semibold))
(t . t)))) ; default style for all other levels
Note that the text color of headings, of their background, and
overline can all be set via the overrides. It is possible to
have any color combination for any heading level (something that
could not be done in older versions of the themes).
Read Info node `(modus-themes) Option for palette overrides' as
well as Info node `(modus-themes) Make headings more or less
colorful'. Else check `modus-themes-common-palette-overrides'
and related user options."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type `(alist
:options ,(mapcar (lambda (el)
(list el modus-themes--headings-widget))
'(0 1 2 3 4 5 6 7 8 t agenda-date agenda-structure))
:key-type symbol
:value-type ,modus-themes--headings-widget)
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) Heading styles"))
(make-obsolete-variable 'modus-themes-org-blocks nil "4.4.0: Use palette overrides")
(defcustom modus-themes-completions nil
"Control the style of completion user interfaces.
This affects Company, Corfu, Flx, Icomplete/Fido, Ido, Ivy,
Orderless, Vertico, and the standard *Completions* buffer. The
value is an alist of expressions, each of which takes the form
of (KEY . LIST-OF-PROPERTIES). KEY is a symbol, while PROPERTIES
is a list. Here is a sample, followed by a description of the
particularities:
(setq modus-themes-completions
(quote ((matches . (extrabold underline))
(selection . (semibold italic)))))
The `matches' key refers to the highlighted characters that
correspond to the user's input. When its properties are nil or
an empty list, matching characters in the user interface will
have a bold weight and a colored foreground. The list of
properties may include any of the following symbols regardless of
the order they may appear in:
- `underline' to draw a line below the characters;
- `italic' to use a slanted font (italic or oblique forms);
- The symbol of a font weight attribute such as `light',
`semibold', et cetera. Valid symbols are defined in the
variable `modus-themes-weights'. The absence of a weight means
that bold will be used.
The `selection' key applies to the current line or currently
matched candidate, depending on the specifics of the user
interface. When its properties are nil or an empty list, it has
a subtle gray background, a bold weight, and the base foreground
value for the text. The list of properties it accepts is as
follows (order is not significant):
- `underline' to draw a line below the characters;
- `italic' to use a slanted font (italic or oblique forms);
- The symbol of a font weight attribute such as `light',
`semibold', et cetera. Valid symbols are defined in the
variable `modus-themes-weights'. The absence of a weight means
that bold will be used.
Apart from specifying each key separately, a catch-all list is
accepted. This is only useful when the desired aesthetic is the
same across all keys that are not explicitly referenced. For
example, this:
(setq modus-themes-completions
(quote ((t . (extrabold underline)))))
Is the same as:
(setq modus-themes-completions
(quote ((matches . (extrabold underline))
(selection . (extrabold underline)))))"
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type `(set
(cons :tag "Matches"
(const matches)
(set :tag "Style of matches" :greedy t
,modus-themes--weight-widget
(const :tag "Italic font (oblique or slanted forms)" italic)
(const :tag "Underline" underline)))
(cons :tag "Selection"
(const selection)
(set :tag "Style of selection" :greedy t
,modus-themes--weight-widget
(const :tag "Italic font (oblique or slanted forms)" italic)
(const :tag "Underline" underline)))
(cons :tag "Fallback for both matches and selection"
(const t)
(set :tag "Style of both matches and selection" :greedy t
,modus-themes--weight-widget
(const :tag "Italic font (oblique or slanted forms)" italic)
(const :tag "Underline" underline))))
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) Completion UIs"))
(defcustom modus-themes-prompts nil
"Use subtle or intense styles for minibuffer and REPL prompts.
The value is a list of properties, each designated by a symbol.
The default (a nil value or an empty list) means to only use a
subtle colored foreground color.
The `italic' property adds a slant to the font's forms (italic or
oblique forms, depending on the typeface).
The symbol of a font weight attribute such as `light', `semibold',
et cetera, adds the given weight to links. Valid symbols are
defined in the variable `modus-themes-weights'. The absence of a
weight means that the one of the underlying text will be used.
Combinations of any of those properties are expressed as a list,
like in these examples:
(bold italic)
(italic semibold)
The order in which the properties are set is not significant.
In user configuration files the form may look like this:
(setq modus-themes-prompts (quote (extrabold italic)))"
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type `(set :tag "Properties" :greedy t
(const :tag "Italic font slant" italic)
,modus-themes--weight-widget)
:set #'modus-themes--set-option
: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.
Mirror the elements of a theme's palette, overriding their value.
The palette variables are named THEME-NAME-palette, while
individual theme overrides are THEME-NAME-palette-overrides. The
THEME-NAME is one of the symbols in `modus-themes-items'. For
example:
- `modus-operandi-palette'
- `modus-operandi-palette-overrides'
Individual theme overrides take precedence over these common
overrides.
The idea of common overrides is to change semantic color
mappings, such as to make the cursor red. Wherea theme-specific
overrides can also be used to change the value of a named color,
such as what hexadecimal RGB value the red-warmer symbol
represents."
:group 'modus-themes
:package-version '(modus-themes . "4.0.0")
:version "30.1"
:type '(repeat (list symbol (choice symbol string)))
;; ;; NOTE 2023-01-07: The following is a functioning version of the
;; ;; intended :type. However, I think the Custom UI is really
;; ;; awkward for this specific case. Maybe the generic type I have
;; ;; above is better, as it encourages the user to write out the
;; ;; code and read the manual. Counter-arguments are welcome.
;;
;; :type `(repeat (list (radio :tag "Palette key to override"
;; ,@(mapcar (lambda (x)
;; (list 'const x))
;; (mapcar #'car (modus-themes--current-theme-palette))))
;; (choice :tag "Value to assign" :value unspecified
;; (const :tag "`unspecified' (remove the original color)" unspecified)
;; (string :tag "String with color name (e.g. \"gray50\") or hex RGB (e.g. \"#123456\")"
;; :match-inline (color-supported-p val))
;; (radio :tag "Palette key to map to"
;; ,@(mapcar (lambda (x)
;; (list 'const x))
;; (mapcar #'car (modus-themes--current-theme-palette)))))))
:set #'modus-themes--set-option
:initialize #'custom-initialize-default
:link '(info-link "(modus-themes) Palette overrides"))
;;;; Presets of palette overrides
(defvar modus-themes-preset-overrides-faint
'((bg-completion bg-inactive)
(bg-hl-line bg-dim)
(bg-paren-match bg-cyan-subtle)
(bg-region bg-active)
(bg-mode-line-active bg-inactive)
(border-mode-line-active fg-dim)
(bg-mode-line-inactive bg-dim)
(border-mode-line-inactive bg-active)
(bg-tab-bar bg-inactive)
(bg-tab-current bg-main)
(bg-tab-other bg-active)
(fringe unspecified)
(builtin maroon)
(comment fg-dim)
(constant blue-faint)
(docstring fg-alt)
(docmarkup magenta-faint)
(fnname pink)
(keyword indigo)
(preprocessor rust)
(string slate)
(type cyan-faint)
(variable cyan-faint)
(rx-construct gold)
(rx-backslash olive)
(underline-err red-faint)
(underline-warning yellow-faint)
(underline-note cyan-faint)
(bg-button-active bg-main)
(fg-button-active fg-main)
(bg-button-inactive bg-inactive)
(fg-button-inactive "gray50")
(date-common cyan-faint)
(date-deadline red-faint)
(date-event fg-alt)
(date-holiday magenta)
(date-now fg-main)
(date-scheduled yellow-faint)
(date-weekday fg-dim)
(date-weekend fg-dim)
(name maroon)
(identifier fg-dim)
(fg-line-number-active fg-main)
(fg-line-number-inactive "gray50")
(bg-line-number-active unspecified)
(bg-line-number-inactive unspecified)
(fg-link blue-faint)
(bg-link unspecified)
(underline-link bg-active)
(fg-link-symbolic cyan-faint)
(bg-link-symbolic unspecified)
(underline-link-symbolic bg-active)
(fg-link-visited magenta-faint)
(bg-link-visited unspecified)
(underline-link-visited bg-active)
(mail-cite-0 cyan-faint)
(mail-cite-1 yellow-faint)
(mail-cite-2 green-faint)
(mail-cite-3 red-faint)
(mail-part olive)
(mail-recipient indigo)
(mail-subject maroon)
(mail-other slate)
(fg-prompt cyan-faint)
(fg-prose-code olive)
(fg-prose-macro indigo)
(fg-prose-verbatim maroon)
(prose-done green-faint)
(prose-tag rust)
(prose-todo red-faint)
(rainbow-0 fg-main)
(rainbow-1 magenta)
(rainbow-2 cyan)
(rainbow-3 red-faint)
(rainbow-4 yellow-faint)
(rainbow-5 magenta-cooler)
(rainbow-6 green)
(rainbow-7 blue-warmer)
(rainbow-8 magenta-faint))
"Preset for palette overrides with faint coloration.
This changes many parts of the theme to make them look less
colorful/intense. Grays are toned down, gray backgrounds are
removed from some contexts, and almost all accent colors are
desaturated.
All the preset overrides the themes provide (including this one):
- `modus-themes-preset-overrides-faint'
- `modus-themes-preset-overrides-intense'
- `modus-themes-preset-overrides-cooler'
- `modus-themes-preset-overrides-warmer'
To set a preset, assign its symbol without a quote as the value
of the `modus-themes-common-palette-overrides' or as the value of
theme-specific options such as `modus-operandi-palette-overrides'.
For overriding named colors and/or semantic color mappings read
Info node `(modus-themes) Option for palette overrides'.")
(defvar modus-themes-preset-overrides-intense
'((bg-region bg-cyan-intense)
(bg-completion bg-cyan-subtle)
(bg-hover bg-yellow-intense)
(bg-hover-secondary bg-magenta-intense)
(bg-hl-line bg-cyan-subtle)
(bg-mode-line-active bg-blue-subtle)
(fg-mode-line-active fg-main)
(border-mode-line-active blue-intense)
(fringe bg-inactive)
(comment red-faint)
(date-common cyan)
(date-deadline red)
(date-event blue)
(date-holiday magenta-warmer)
(date-now blue-faint)
(date-range blue)
(date-scheduled yellow-warmer)
(date-weekday fg-main)
(date-weekend red-faint)
(keybind blue-intense)
(mail-cite-0 blue)
(mail-cite-1 yellow-cooler)
(mail-cite-2 green-warmer)
(mail-cite-3 magenta)
(mail-part cyan)
(mail-recipient magenta-cooler)
(mail-subject red-warmer)
(mail-other cyan-cooler)
(fg-prompt blue-intense)
(bg-prose-block-delimiter bg-dim)
(fg-prose-block-delimiter red-faint)
(prose-done green-intense)
(prose-metadata magenta-faint)
(prose-metadata-value blue-cooler)
(prose-table blue)
(prose-todo red-intense)
(fg-heading-0 blue-cooler)
(fg-heading-1 magenta-cooler)
(fg-heading-2 magenta-warmer)
(fg-heading-3 blue)
(fg-heading-4 cyan)
(fg-heading-5 green-warmer)
(fg-heading-6 yellow)
(fg-heading-7 red)
(fg-heading-8 magenta)
(bg-heading-0 unspecified)
(bg-heading-1 bg-magenta-nuanced)
(bg-heading-2 bg-red-nuanced)
(bg-heading-3 bg-blue-nuanced)
(bg-heading-4 bg-cyan-nuanced)
(bg-heading-5 bg-green-nuanced)
(bg-heading-6 bg-yellow-nuanced)
(bg-heading-7 bg-red-nuanced)
(bg-heading-8 bg-magenta-nuanced)
(overline-heading-0 unspecified)
(overline-heading-1 magenta-cooler)
(overline-heading-2 magenta-warmer)
(overline-heading-3 blue)
(overline-heading-4 cyan)
(overline-heading-5 green)
(overline-heading-6 yellow-cooler)
(overline-heading-7 red-cooler)
(overline-heading-8 magenta))
"Preset for palette overrides with intense coloration.
This changes many parts of the theme to make them look more
colorful/intense. Many background colors are accented and
coloration is increased to pop out more.
All the preset overrides the themes provide (including this one):
- `modus-themes-preset-overrides-faint'
- `modus-themes-preset-overrides-intense'
- `modus-themes-preset-overrides-cooler'
- `modus-themes-preset-overrides-warmer'
To set a preset, assign its symbol without a quote as the value
of the `modus-themes-common-palette-overrides' or as the value of
theme-specific options such as `modus-operandi-palette-overrides'.
For overriding named colors and/or semantic color mappings read
Info node `(modus-themes) Option for palette overrides'.")
(defvar modus-themes-preset-overrides-cooler
'((fg-prompt blue-cooler)
(builtin magenta-faint)
(constant blue-cooler)
(fnname cyan-cooler)
(keyword magenta-cooler)
(preprocessor blue)
(string blue-warmer)
(type green-cooler)
(variable cyan)
(rx-construct blue-cooler)
(rx-backslash red)
(name blue-warmer)
(identifier magenta-faint)
(date-deadline magenta-cooler)
(date-scheduled yellow-cooler)
(date-weekday blue-faint)
(date-weekend red-faint)
(mail-cite-0 blue-faint)
(mail-cite-1 cyan-cooler)
(mail-cite-2 magenta-faint)
(mail-cite-3 yellow-cooler)
(mail-part cyan)
(mail-recipient blue-warmer)
(mail-subject magenta-cooler)
(mail-other blue)
(prose-tag fg-dim)
(fg-prose-verbatim blue-cooler))
"Preset of palette overrides with cooler colors.
This changes parts of the palette to use more blue and
blue-tinted colors.
All the preset overrides the themes provide (including this one):
- `modus-themes-preset-overrides-faint'
- `modus-themes-preset-overrides-intense'
- `modus-themes-preset-overrides-cooler'
- `modus-themes-preset-overrides-warmer'
To set a preset, assign its symbol without a quote as the value
of the `modus-themes-common-palette-overrides' or as the value of
theme-specific options such as `modus-operandi-palette-overrides'.
For overriding named colors and/or semantic color mappings read
Info node `(modus-themes) Option for palette overrides'.")
(defvar modus-themes-preset-overrides-warmer
'((fg-prompt magenta-warmer)
(builtin magenta)
(constant blue-warmer)
(fnname magenta-cooler)
(keyword magenta-warmer)
(preprocessor red-cooler)
(string green-warmer)
(type cyan-cooler)
(variable cyan)
(rx-construct blue-cooler)
(rx-backslash red-warmer)
(name blue-warmer)
(identifier magenta)
(keybind magenta-warmer)
(accent-0 magenta-warmer)
(accent-1 cyan)
(accent-2 blue-warmer)
(accent-3 red-cooler)
(date-common cyan-cooler)
(date-holiday magenta-warmer)