New customisation option: modus-themes-region

This commit is contained in:
Protesilaos Stavrou 2020-11-27 11:50:20 +02:00
parent 9eb5662260
commit 990d331f2c
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
3 changed files with 167 additions and 67 deletions

View file

@ -81,6 +81,7 @@ Customization Options
* Fringes:: Choose among invisible, subtle, or intense fringe visibility
* Line highlighting:: Toggle intense style for current line highlighting
* Matching parentheses:: Choose between various styles for matching delimiters/parentheses
* Active region:: Choose between various styles for the active region
* Diffs:: Choose among intense, desaturated, or text-only diffs
* Org mode blocks:: Choose among plain, grayscale, or rainbow styles
* Heading styles:: Choose among several styles, also per heading level
@ -463,6 +464,7 @@ loading a theme (see *note Enable and load::).
* Fringes:: Choose among invisible, subtle, or intense fringe visibility
* Line highlighting:: Toggle intense style for current line highlighting
* Matching parentheses:: Choose between various styles for matching delimiters/parentheses
* Active region:: Choose between various styles for the active region
* Diffs:: Choose among intense, desaturated, or text-only diffs
* Org mode blocks:: Choose among plain, grayscale, or rainbow styles
* Heading styles:: Choose among several styles, also per heading level
@ -774,7 +776,7 @@ instead.
elfeed and mu4e.

File: modus-themes.info, Node: Matching parentheses, Next: Diffs, Prev: Line highlighting, Up: Customization Options
File: modus-themes.info, Node: Matching parentheses, Next: Active region, Prev: Line highlighting, Up: Customization Options
4.11 Option for parenthesis matching (show-paren-mode)
======================================================
@ -803,9 +805,38 @@ bold weight.
show-paren-mode and smartparens.

File: modus-themes.info, Node: Diffs, Next: Org mode blocks, Prev: Matching parentheses, Up: Customization Options
File: modus-themes.info, Node: Active region, Next: Diffs, Prev: Matching parentheses, Up: Customization Options
4.12 Option for diff buffer looks
4.12 Option for active region
=============================
Symbol: modus-themes-region
Possible values:
1. nil (default)
2. no-extend
3. bg-only
4. bg-only-no-extend
Nil means to only use a prominent gray background with a neutral
foreground. The foreground overrides all syntax highlighting. The
region extends to the edge of the window.
Option no-extend preserves the default aesthetic but prevents the
region from extending to the edge of the window.
Option bg-only applies a faint tinted background that is distinct
from all others used in the theme, while it does not override any
existing colors. It extends to the edge of the window.
Option bg-only-no-extend is a combination of the bg-only and
no-extend options.

File: modus-themes.info, Node: Diffs, Next: Org mode blocks, Prev: Active region, Up: Customization Options
4.13 Option for diff buffer looks
=================================
Symbol: modus-themes-diffs
@ -854,7 +885,7 @@ accordingly).

File: modus-themes.info, Node: Org mode blocks, Next: Heading styles, Prev: Diffs, Up: Customization Options
4.13 Option for org-mode block styles
4.14 Option for org-mode block styles
=====================================
Symbol: modus-themes-org-blocks
@ -888,7 +919,7 @@ each code block (inefficient at scale, but it still works).

File: modus-themes.info, Node: Heading styles, Next: Scaled headings, Prev: Org mode blocks, Up: Customization Options
4.14 Option for the headings overall style
4.15 Option for the headings overall style
===========================================
This is defined as an alist and, therefore, uses a different approach
@ -994,7 +1025,7 @@ option, just specify the value t like this:

File: modus-themes.info, Node: Scaled headings, Next: Headings' font, Prev: Heading styles, Up: Customization Options
4.15 Option for scaled headings
4.16 Option for scaled headings
===============================
Symbol: modus-themes-scale-headings
@ -1016,7 +1047,7 @@ the main text. This is noticeable in modes like Org.

File: modus-themes.info, Node: Scaled heading sizes, Up: Scaled headings
4.15.1 Control the scale of headings
4.16.1 Control the scale of headings
------------------------------------
In addition to toggles for enabling scaled headings, users can also
@ -1052,7 +1083,7 @@ size of the heading, but not of keywords that were added to it, like

File: modus-themes.info, Node: Headings' font, Prev: Scaled headings, Up: Customization Options
4.16 Option for variable-pitch font in headings
4.17 Option for variable-pitch font in headings
===============================================
Symbol: modus-themes-variable-pitch-headings
@ -2520,64 +2551,65 @@ Appendix A GNU Free Documentation License

Tag Table:
Node: Top232
Node: Overview4135
Node: How do the themes look like5405
Node: Learn about the latest changes5913
Node: Installation6295
Node: Install from the archives6743
Node: Install on GNU/Linux7405
Node: Debian 11 Bullseye7853
Node: GNU Guix8262
Node: Enable and load8551
Node: Load automatically9038
Node: Toggle between the themes on demand9855
Node: Configure options prior to loading10805
Node: Sample configuration for use-package14149
Node: Customization Options15840
Node: Bold constructs17645
Node: Slanted constructs18234
Node: Syntax styles18781
Node: No mixed fonts20296
Node: Link styles21307
Node: Command prompts22286
Node: Mode line22969
Node: Completion UIs25492
Node: Fringes27324
Node: Line highlighting27984
Node: Matching parentheses28599
Node: Diffs29474
Node: Org mode blocks31753
Node: Heading styles33093
Node: Scaled headings36759
Node: Scaled heading sizes37345
Node: Headings' font38919
Node: Advanced customization (do-it-yourself)39519
Node: Tweak faces (DIY)40597
Node: Font configs (DIY)44753
Ref: Font configs (DIY)-Footnote-147029
Node: Org user faces (DIY)47216
Node: Check color combinations (DIY)50451
Node: Face coverage52328
Node: Supported packages52798
Node: Indirectly covered packages58942
Node: Notes for individual packages59385
Node: Note on company-mode overlay pop-up59871
Ref: Note on company-mode overlay pop-up-Footnote-160535
Ref: Note on company-mode overlay pop-up-Footnote-260602
Node: Note for ERC escaped color sequences60657
Ref: Note for ERC escaped color sequences-Footnote-162090
Node: Note for powerline or spaceline62200
Node: Note on SHR colors62616
Node: Note for Helm grep63026
Node: Note on vc-annotate-background-mode64471
Node: Contributing65323
Node: Sources of the themes65742
Node: Issues you can help with66483
Node: Merge requests67664
Node: Acknowledgements69926
Node: Meta71636
Node: External projects (ports)73142
Node: GNU Free Documentation License73964
Node: Overview4220
Node: How do the themes look like5490
Node: Learn about the latest changes5998
Node: Installation6380
Node: Install from the archives6828
Node: Install on GNU/Linux7490
Node: Debian 11 Bullseye7938
Node: GNU Guix8347
Node: Enable and load8636
Node: Load automatically9123
Node: Toggle between the themes on demand9940
Node: Configure options prior to loading10890
Node: Sample configuration for use-package14234
Node: Customization Options15925
Node: Bold constructs17815
Node: Slanted constructs18404
Node: Syntax styles18951
Node: No mixed fonts20466
Node: Link styles21477
Node: Command prompts22456
Node: Mode line23139
Node: Completion UIs25662
Node: Fringes27494
Node: Line highlighting28154
Node: Matching parentheses28769
Node: Active region29652
Node: Diffs30588
Node: Org mode blocks32860
Node: Heading styles34200
Node: Scaled headings37866
Node: Scaled heading sizes38452
Node: Headings' font40026
Node: Advanced customization (do-it-yourself)40626
Node: Tweak faces (DIY)41704
Node: Font configs (DIY)45860
Ref: Font configs (DIY)-Footnote-148136
Node: Org user faces (DIY)48323
Node: Check color combinations (DIY)51558
Node: Face coverage53435
Node: Supported packages53905
Node: Indirectly covered packages60049
Node: Notes for individual packages60492
Node: Note on company-mode overlay pop-up60978
Ref: Note on company-mode overlay pop-up-Footnote-161642
Ref: Note on company-mode overlay pop-up-Footnote-261709
Node: Note for ERC escaped color sequences61764
Ref: Note for ERC escaped color sequences-Footnote-163197
Node: Note for powerline or spaceline63307
Node: Note on SHR colors63723
Node: Note for Helm grep64133
Node: Note on vc-annotate-background-mode65578
Node: Contributing66430
Node: Sources of the themes66849
Node: Issues you can help with67590
Node: Merge requests68771
Node: Acknowledgements71033
Node: Meta72743
Node: External projects (ports)74249
Node: GNU Free Documentation License75071

End Tag Table

View file

@ -683,6 +683,36 @@ weight.
This customization variable affects tools such as the built-in
=show-paren-mode= and =smartparens=.
** Option for active region
:PROPERTIES:
:ALT_TITLE: Active region
:DESCRIPTION: Choose between various styles for the active region
:CUSTOM_ID: h:60798063-b4ad-45ea-b9a7-ff7b5c0ab74c
:END:
Symbol: =modus-themes-region=
Possible values:
1. =nil= (default)
2. =no-extend=
3. =bg-only=
4. =bg-only-no-extend=
Nil means to only use a prominent gray background with a neutral
foreground. The foreground overrides all syntax highlighting. The
region extends to the edge of the window.
Option =no-extend= preserves the default aesthetic but prevents the
region from extending to the edge of the window.
Option =bg-only= applies a faint tinted background that is distinct from
all others used in the theme, while it does not override any existing
colors. It extends to the edge of the window.
Option =bg-only-no-extend= is a combination of the =bg-only= and
=no-extend= options.
** Option for diff buffer looks
:PROPERTIES:
:ALT_TITLE: Diffs

View file

@ -49,6 +49,7 @@
;; modus-themes-syntax (choice)
;; modus-themes-intense-hl-line (boolean)
;; modus-themes-paren-match (choice)
;; modus-themes-region (choice)
;; modus-themes-links (choice)
;; modus-themes-completions (choice)
;;
@ -869,6 +870,31 @@ Option `no-underline' removes link underlines altogether."
(const :tag "Desaturated foreground with neutral grey underline" faint-neutral-underline)
(const :tag "Remove underline property from links, keeping their foreground as-is" no-underline)))
(defcustom modus-themes-region nil
"Change the overall appearance of the active region.
Nil (the default) means to only use a prominent gray background
with a neutral foreground. The foreground overrides all syntax
highlighting. The region extends to the edge of the window.
Option `no-extend' preserves the default aesthetic but prevents
the region from extending to the edge of the window.
Option `bg-only' applies a faint tinted background that is
distinct from all others used in the theme, while it does not
override any existing colors. It extends to the edge of the
window.
Option `bg-only-no-extend' is a combination of the `bg-only' and
`no-extend' options."
:package-version '(modus-themes . "1.0.0")
:version "28.1"
:type '(choice
(const :tag "Intense background; overrides colors; extends to edge of window (default)" nil)
(const :tag "As with the default, but does not extend" no-extend)
(const :tag "Subtle background; preserves colors; extends to edge of window" bg-only)
(const :tag "As with the `subtle' option, but does not extend" bg-only-no-extend)))
;;; Variables for each variant
@ -1714,6 +1740,18 @@ AMOUNT is a customization option."
(when modus-themes-scale-headings
(list :height amount)))
(defun modus-themes--region (bg fg bgsubtle)
"Apply `modus-themes-region' styles.
BG and FG are the main values that are used by default. BGSUBTLE
is a subtle background value that can be combined with all colors
used to fontify text and code syntax."
(pcase modus-themes-region
('bg-only (list :background bgsubtle))
('bg-only-no-extend (list :background bgsubtle :extend nil))
('no-extend (list :background bg :foreground fg :extend nil))
(_ (list :background bg :foreground bg))))
;;;; Utilities for DIY users
@ -2010,7 +2048,7 @@ calling the internal `modus-themes-load-operandi' and
`(mm-uu-extract ((,class :background ,bg-dim :foreground ,fg-special-mild)))
`(next-error ((,class :inherit modus-theme-subtle-red)))
`(rectangle-preview ((,class :inherit modus-theme-special-mild)))
`(region ((,class :background ,bg-region :foreground ,fg-main)))
`(region ((,class ,@(modus-themes--region bg-region fg-main bg-hl-alt-intense))))
`(secondary-selection ((,class :inherit modus-theme-special-cold)))
`(shadow ((,class :foreground ,fg-alt)))
`(success ((,class :inherit bold :foreground ,green)))