From 67c57ba4dd5e262a92138e922a1e7454f13a330c Mon Sep 17 00:00:00 2001 From: Protesilaos Stavrou Date: Mon, 11 Oct 2021 19:43:43 +0300 Subject: [PATCH] Add modus-themes-mode-line-padding option Thanks to Guilherme Semente and Manuel Uberti for the feedback in issue 245: . --- README.md | 4 + doc/modus-themes.info | 256 ++++++++++++++++++++++++------------------ doc/modus-themes.org | 54 ++++++--- modus-themes.el | 32 +++++- 4 files changed, 216 insertions(+), 130 deletions(-) diff --git a/README.md b/README.md index 471ca36..4b74384 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,10 @@ demonstration: ;; that can combine any of `3d' OR `moody', `borderless', ;; `accented', `padded'. modus-themes-mode-line '(padded accented borderless) + + ;; This one only works when `modus-themes-mode-line' (above) has + ;; the `padded' property. It takes a positive integer. + modus-themes-mode-line-padding 3 ;; Options for `modus-themes-syntax' are either nil (the default), ;; or a list of properties that may include any of those symbols: diff --git a/doc/modus-themes.info b/doc/modus-themes.info index 068a3a3..89f125f 100644 --- a/doc/modus-themes.info +++ b/doc/modus-themes.info @@ -117,6 +117,10 @@ Customization Options * UI typeface:: Toggle the use of variable-pitch across the User Interface * Headings' typeface:: Toggle the use of variable-pitch in headings +Mode line + +* Option for mode line padding:: + Scaled headings * Scaled heading sizes:: Specify rate of increase for scaled headings @@ -541,6 +545,10 @@ of this manual. ;; `accented', `padded'. modus-themes-mode-line '(padded accented borderless) + ;; This one only works when `modus-themes-mode-line' (above) has + ;; the `padded' property. It takes a positive integer. + modus-themes-mode-line-padding 3 + ;; Options for `modus-themes-syntax' are either nil (the default), ;; or a list of properties that may include any of those symbols: ;; `faint', `yellow-comments', `green-strings', `alt-syntax' @@ -986,7 +994,10 @@ This is done by applying box effects and combining them with an underline and overline. To ensure that the underline is placed at the bottom, set ‘x-underline-at-descent-line’ to non-nil. The ‘padded’ property has no effect when the ‘moody’ property is also used, because -Moody already applies its own padding. +Moody already applies its own padding. The exact value of the padding +is controlled by the variable ‘modus-themes-mode-line-padding’. + + *note Option for mode line padding::. Combinations of any of those properties are expressed as a list, like in these examples: @@ -1030,6 +1041,28 @@ line, such as ‘doom-modeline’, ‘nano-modeline’, ‘powerline’, ‘spac may not look as intended with all possible combinations of this user option. +* Menu: + +* Option for mode line padding:: + + +File: modus-themes.info, Node: Option for mode line padding, Up: Mode line + +4.9.1 Option for mode line padding +---------------------------------- + +[ Part of 1.7.0-dev ] + + Symbol: ‘modus-themes-mode-line-padding’ + + Controls the exact width of the mode line’s padding. Possible values +are positive integers. The default value is ‘6’. + + This customization option applies only when ‘modus-themes-mode-line’ +is configured with the ‘padded’ property. + + *note Option for mode line presentation: Mode line. +  File: modus-themes.info, Node: Tab style, Next: Completion UIs, Prev: Mode line, Up: Customization Options @@ -4496,17 +4529,17 @@ Ideas and user feedback Mendler, Dario Gjorgjevski, David Edmondson, Davor Rotim, Divan Santana, Eliraz Kedmi, Emanuele Michele Alberto Monterosso, Farasha Euker, Feng Shu, Gautier Ponsinet, Gerry Agbobada, Gianluca - Recchia, Gustavo Barros, Hörmetjan Yiltiz, Ilja Kocken, Iris - Garcia, Jeremy Friesen, Jerry Zhang, Johannes Grødem, John Haman, - Joshua O’Connor, Kevin Fleming, Kévin Le Gouguec, Kostadin Ninev, - Len Trigg, Manuel Uberti, Mark Burton, Markus Beppler, Mauro - Aranda, Michael Goldenberg, Morgan Smith, Murilo Pereira, Nicky van - Foreest, Nicolas De Jaeghere, Paul Poloskov, Pengji Zhang, Pete - Kazmier, Peter Wu, Philip Kaludercic, Pierre Téchoueyres, Roman - Rudakov, Ryan Phillips, Rudolf Adamkovič, Sam Kleinman, Shreyas - Ragavan, Simon Pugnet, Tassilo Horn, Thibaut Verron, Thomas - Heartman, Trey Merkley, Togan Muftuoglu, Toon Claes, Uri Sharf, - Utkarsh Singh, Vincent Foley. As well as users: Ben, + Recchia, Guilherme Semente, Gustavo Barros, Hörmetjan Yiltiz, Ilja + Kocken, Iris Garcia, Jeremy Friesen, Jerry Zhang, Johannes Grødem, + John Haman, Joshua O’Connor, Kevin Fleming, Kévin Le Gouguec, + Kostadin Ninev, Len Trigg, Manuel Uberti, Mark Burton, Markus + Beppler, Mauro Aranda, Michael Goldenberg, Morgan Smith, Murilo + Pereira, Nicky van Foreest, Nicolas De Jaeghere, Paul Poloskov, + Pengji Zhang, Pete Kazmier, Peter Wu, Philip Kaludercic, Pierre + Téchoueyres, Roman Rudakov, Ryan Phillips, Rudolf Adamkovič, Sam + Kleinman, Shreyas Ragavan, Simon Pugnet, Tassilo Horn, Thibaut + Verron, Thomas Heartman, Trey Merkley, Togan Muftuoglu, Toon Claes, + Uri Sharf, Utkarsh Singh, Vincent Foley. As well as users: Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik, Moesasji, Nick, TheBlob42, Trey, bepolymathe, doolio, fleimgruber, iSeeU, jixiuf, okamsn, pRot0ta1p. @@ -5118,6 +5151,8 @@ B.2 Variable index * modus-themes-mail-citations: Mail citations. (line 6) * modus-themes-mixed-fonts: Mixed fonts. (line 6) * modus-themes-mode-line: Mode line. (line 6) +* modus-themes-mode-line-padding: Option for mode line padding. + (line 6) * modus-themes-operandi-color-overrides: Override colors (DIY). (line 6) * modus-themes-org-agenda: Org agenda. (line 6) * modus-themes-org-blocks: Org mode blocks. (line 6) @@ -5195,104 +5230,105 @@ B.3 Concept index  Tag Table: Node: Top860 -Node: Overview7059 -Node: How do the themes look like8602 -Node: Learn about the latest changes9110 -Node: Installation9492 -Node: Install manually from source9973 -Node: Install from the archives10798 -Node: Install on GNU/Linux11575 -Node: Debian 11 Bullseye12023 -Node: GNU Guix12333 -Node: Enable and load12616 -Node: Sample configuration for use-package15605 -Node: Differences between loading and enabling16983 -Node: Customization Options19023 -Node: Custom reload theme25674 -Node: Success' color-code26209 -Node: Bold constructs27146 -Node: Italic constructs27935 -Node: Syntax styles28653 -Node: Mixed fonts30683 -Node: Link styles31903 -Node: Command prompts34271 -Node: Mode line35964 -Node: Tab style40125 -Node: Completion UIs40712 -Node: Mail citations42583 -Node: Fringes43436 -Node: Language checkers44098 -Node: Line highlighting46419 -Node: Line numbers47934 -Node: Intense markup49006 -Node: Matching parentheses49690 -Node: Active region50984 -Node: Diffs52313 -Node: Org mode blocks54252 -Node: Org agenda56130 -Node: Heading styles64104 -Node: Scaled headings67146 -Node: Scaled heading sizes67749 -Node: UI typeface71296 -Node: Headings' typeface72142 -Node: Advanced customization (do-it-yourself)72766 -Node: Per-theme customization settings (DIY)74171 -Node: Case-by-case face specs using the themes' palette (DIY)75517 -Node: Face specs at scale using the themes' palette (DIY)79981 -Node: Remap face with local value (DIY)84798 -Node: Cycle through arbitrary colors (DIY)87323 -Node: Override colors (DIY)93889 -Node: Override color saturation (DIY)98782 -Node: Font configurations for Org and others (DIY)104535 -Ref: Font configurations for Org and others (DIY)-Footnote-1107461 -Node: Configure bold and italic faces (DIY)107648 -Node: Custom Org user faces (DIY)111846 -Node: Update Org block delimiter fontification (DIY)115530 -Node: Measure color contrast (DIY)117490 -Node: Load theme depending on time of day (DIY)120281 -Node: Backdrop for pdf-tools (DIY)121321 -Node: A theme-agnostic hook for theme loading (DIY)124110 -Node: Face coverage126500 -Node: Supported packages126969 -Node: Indirectly covered packages133976 -Node: Notes on individual packages134640 -Node: Note on avy hints135698 -Node: Note on calendarel weekday and weekend colors136866 -Node: Note on underlines in compilation buffers138049 -Node: Note on inline Latex in Org buffers138898 -Node: Note on dimmerel139508 -Node: Note on display-fill-column-indicator-mode140993 -Node: Note on highlight-parenthesesel142609 -Node: Note on mmm-modeel background colors148615 -Node: Note for prism150983 -Node: Note for god-mode154190 -Node: Note on company-mode overlay pop-up155864 -Ref: Note on company-mode overlay pop-up-Footnote-1156554 -Ref: Note on company-mode overlay pop-up-Footnote-2156621 -Node: Note on ERC escaped color sequences156676 -Ref: Note on ERC escaped color sequences-Footnote-1158104 -Node: Note on powerline or spaceline158214 -Node: Note on SHR colors158628 -Node: Note on EWW and Elfeed fonts (SHR fonts)159063 -Node: Note on Helm grep159808 -Node: Note on vc-annotate-background-mode161295 -Node: Note on pdf-tools link hints162180 -Node: Frequently Asked Questions (FAQ)164612 -Node: Is the contrast ratio about adjacent colors?165186 -Node: What does it mean to avoid exaggerations?166699 -Node: Why are colors mostly variants of blue magenta cyan?168534 -Node: What is the best setup for legibility?172881 -Node: Contributing175499 -Node: Sources of the themes175902 -Node: Issues you can help with176532 -Node: Patches require copyright assignment to the FSF177732 -Node: Acknowledgements180027 -Node: Meta182663 -Node: GNU Free Documentation License184809 -Node: Indices210161 -Node: Function index210340 -Node: Variable index211577 -Node: Concept index213864 +Node: Overview7104 +Node: How do the themes look like8647 +Node: Learn about the latest changes9155 +Node: Installation9537 +Node: Install manually from source10018 +Node: Install from the archives10843 +Node: Install on GNU/Linux11620 +Node: Debian 11 Bullseye12068 +Node: GNU Guix12378 +Node: Enable and load12661 +Node: Sample configuration for use-package15650 +Node: Differences between loading and enabling17028 +Node: Customization Options19068 +Node: Custom reload theme25907 +Node: Success' color-code26442 +Node: Bold constructs27379 +Node: Italic constructs28168 +Node: Syntax styles28886 +Node: Mixed fonts30916 +Node: Link styles32136 +Node: Command prompts34504 +Node: Mode line36197 +Node: Option for mode line padding40543 +Node: Tab style41075 +Node: Completion UIs41662 +Node: Mail citations43533 +Node: Fringes44386 +Node: Language checkers45048 +Node: Line highlighting47369 +Node: Line numbers48884 +Node: Intense markup49956 +Node: Matching parentheses50640 +Node: Active region51934 +Node: Diffs53263 +Node: Org mode blocks55202 +Node: Org agenda57080 +Node: Heading styles65054 +Node: Scaled headings68096 +Node: Scaled heading sizes68699 +Node: UI typeface72246 +Node: Headings' typeface73092 +Node: Advanced customization (do-it-yourself)73716 +Node: Per-theme customization settings (DIY)75121 +Node: Case-by-case face specs using the themes' palette (DIY)76467 +Node: Face specs at scale using the themes' palette (DIY)80931 +Node: Remap face with local value (DIY)85748 +Node: Cycle through arbitrary colors (DIY)88273 +Node: Override colors (DIY)94839 +Node: Override color saturation (DIY)99732 +Node: Font configurations for Org and others (DIY)105485 +Ref: Font configurations for Org and others (DIY)-Footnote-1108411 +Node: Configure bold and italic faces (DIY)108598 +Node: Custom Org user faces (DIY)112796 +Node: Update Org block delimiter fontification (DIY)116480 +Node: Measure color contrast (DIY)118440 +Node: Load theme depending on time of day (DIY)121231 +Node: Backdrop for pdf-tools (DIY)122271 +Node: A theme-agnostic hook for theme loading (DIY)125060 +Node: Face coverage127450 +Node: Supported packages127919 +Node: Indirectly covered packages134926 +Node: Notes on individual packages135590 +Node: Note on avy hints136648 +Node: Note on calendarel weekday and weekend colors137816 +Node: Note on underlines in compilation buffers138999 +Node: Note on inline Latex in Org buffers139848 +Node: Note on dimmerel140458 +Node: Note on display-fill-column-indicator-mode141943 +Node: Note on highlight-parenthesesel143559 +Node: Note on mmm-modeel background colors149565 +Node: Note for prism151933 +Node: Note for god-mode155140 +Node: Note on company-mode overlay pop-up156814 +Ref: Note on company-mode overlay pop-up-Footnote-1157504 +Ref: Note on company-mode overlay pop-up-Footnote-2157571 +Node: Note on ERC escaped color sequences157626 +Ref: Note on ERC escaped color sequences-Footnote-1159054 +Node: Note on powerline or spaceline159164 +Node: Note on SHR colors159578 +Node: Note on EWW and Elfeed fonts (SHR fonts)160013 +Node: Note on Helm grep160758 +Node: Note on vc-annotate-background-mode162245 +Node: Note on pdf-tools link hints163130 +Node: Frequently Asked Questions (FAQ)165562 +Node: Is the contrast ratio about adjacent colors?166136 +Node: What does it mean to avoid exaggerations?167649 +Node: Why are colors mostly variants of blue magenta cyan?169484 +Node: What is the best setup for legibility?173831 +Node: Contributing176449 +Node: Sources of the themes176852 +Node: Issues you can help with177482 +Node: Patches require copyright assignment to the FSF178682 +Node: Acknowledgements180977 +Node: Meta183632 +Node: GNU Free Documentation License185778 +Node: Indices211130 +Node: Function index211309 +Node: Variable index212546 +Node: Concept index214977  End Tag Table diff --git a/doc/modus-themes.org b/doc/modus-themes.org index e2fff08..5d328bf 100644 --- a/doc/modus-themes.org +++ b/doc/modus-themes.org @@ -400,6 +400,10 @@ this manual. ;; `accented', `padded'. modus-themes-mode-line '(padded accented borderless) + ;; This one only works when `modus-themes-mode-line' (above) has + ;; the `padded' property. It takes a positive integer. + modus-themes-mode-line-padding 3 + ;; Options for `modus-themes-syntax' are either nil (the default), ;; or a list of properties that may include any of those symbols: ;; `faint', `yellow-comments', `green-strings', `alt-syntax' @@ -841,7 +845,10 @@ This is done by applying box effects and combining them with an underline and overline. To ensure that the underline is placed at the bottom, set ~x-underline-at-descent-line~ to non-nil. The ~padded~ property has no effect when the ~moody~ property is also used, because Moody -already applies its own padding. +already applies its own padding. The exact value of the padding is +controlled by the variable ~modus-themes-mode-line-padding~. + +[[#h:a12b4d3c-e66b-42ed-99ab-4ea039b69e2e][Option for mode line padding]]. Combinations of any of those properties are expressed as a list, like in these examples: @@ -886,6 +893,24 @@ Finally, note that various packages which heavily modify the mode line, such as =doom-modeline=, =nano-modeline=, =powerline=, =spaceline= may not look as intended with all possible combinations of this user option. +*** Option for mode line padding +:properties: +:custom_id: h:a12b4d3c-e66b-42ed-99ab-4ea039b69e2e +:end: +#+vindex: modus-themes-mode-line-padding + +[ Part of {{{development-version}}} ] + +Symbol: ~modus-themes-mode-line-padding~ + +Controls the exact width of the mode line's padding. Possible values +are positive integers. The default value is =6=. + +This customization option applies only when ~modus-themes-mode-line~ is +configured with the ~padded~ property. + +[[#h:27943af6-d950-42d0-bc23-106e43f50a24][Option for mode line presentation]]. + ** Option for accented background in tab interfaces :properties: :alt_title: Tab style @@ -4401,19 +4426,20 @@ The Modus themes are a collective effort. Every bit of work matters. Dimech, Damien Cassou, Daniel Mendler, Dario Gjorgjevski, David Edmondson, Davor Rotim, Divan Santana, Eliraz Kedmi, Emanuele Michele Alberto Monterosso, Farasha Euker, Feng Shu, Gautier Ponsinet, Gerry - Agbobada, Gianluca Recchia, Gustavo Barros, Hörmetjan Yiltiz, Ilja - Kocken, Iris Garcia, Jeremy Friesen, Jerry Zhang, Johannes Grødem, - John Haman, Joshua O'Connor, Kevin Fleming, Kévin Le Gouguec, Kostadin - Ninev, Len Trigg, Manuel Uberti, Mark Burton, Markus Beppler, Mauro - Aranda, Michael Goldenberg, Morgan Smith, Murilo Pereira, Nicky van - Foreest, Nicolas De Jaeghere, Paul Poloskov, Pengji Zhang, Pete - Kazmier, Peter Wu, Philip Kaludercic, Pierre Téchoueyres, Roman - Rudakov, Ryan Phillips, Rudolf Adamkovič, Sam Kleinman, Shreyas - Ragavan, Simon Pugnet, Tassilo Horn, Thibaut Verron, Thomas Heartman, - Trey Merkley, Togan Muftuoglu, Toon Claes, Uri Sharf, Utkarsh Singh, - Vincent Foley. As well as users: Ben, CsBigDataHub1, Emacs Contrib, - Eugene, Fourchaux, Fredrik, Moesasji, Nick, TheBlob42, Trey, - bepolymathe, doolio, fleimgruber, iSeeU, jixiuf, okamsn, pRot0ta1p. + Agbobada, Gianluca Recchia, Guilherme Semente, Gustavo Barros, + Hörmetjan Yiltiz, Ilja Kocken, Iris Garcia, Jeremy Friesen, Jerry + Zhang, Johannes Grødem, John Haman, Joshua O'Connor, Kevin Fleming, + Kévin Le Gouguec, Kostadin Ninev, Len Trigg, Manuel Uberti, Mark + Burton, Markus Beppler, Mauro Aranda, Michael Goldenberg, Morgan + Smith, Murilo Pereira, Nicky van Foreest, Nicolas De Jaeghere, Paul + Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, Philip Kaludercic, + Pierre Téchoueyres, Roman Rudakov, Ryan Phillips, Rudolf Adamkovič, + Sam Kleinman, Shreyas Ragavan, Simon Pugnet, Tassilo Horn, Thibaut + Verron, Thomas Heartman, Trey Merkley, Togan Muftuoglu, Toon Claes, + Uri Sharf, Utkarsh Singh, Vincent Foley. As well as users: Ben, + CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik, Moesasji, + Nick, TheBlob42, Trey, bepolymathe, doolio, fleimgruber, iSeeU, + jixiuf, okamsn, pRot0ta1p. + Packaging :: Basil L.{{{space()}}} Contovounesios, Eli Zaretskii, Glenn Morris, Mauro Aranda, Richard Stallman, Stefan Kangas (core Emacs), diff --git a/modus-themes.el b/modus-themes.el index b264c22..25e62ae 100644 --- a/modus-themes.el +++ b/modus-themes.el @@ -5,7 +5,7 @@ ;; Author: Protesilaos Stavrou ;; URL: https://gitlab.com/protesilaos/modus-themes ;; Version: 1.6.0 -;; Last-Modified: <2021-10-08 18:07:25 +0300> +;; Last-Modified: <2021-10-11 19:30:48 +0300> ;; Package-Requires: ((emacs "27.1")) ;; Keywords: faces, theme, accessibility @@ -60,6 +60,7 @@ ;; modus-themes-prompts (choice) ;; modus-themes-region (choice) ;; modus-themes-syntax (choice) +;; modus-themes-mode-line-padding (natnum) ;; ;; The default scale for headings is as follows (it can be customized as ;; well---remember, no scaling takes place by default): @@ -2529,6 +2530,17 @@ instead of a box style, it is advised to set :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Mode line")) +(defcustom modus-themes-mode-line-padding 6 + "Padding for `modus-themes-mode-line'. +The value is expressed as a positive integer." + :group 'modus-themes + :package-version '(modus-themes . "1.7.0") + :version "29.1" + :type 'natnum + :set #'modus-themes--set-option + :initialize #'custom-initialize-default + :link '(info-link "(modus-themes) Mode line")) + (defcustom modus-themes-diffs nil "Adjust the overall style of diffs. @@ -3589,6 +3601,13 @@ set to `rainbow'." ('rainbow (list :background bgaccent :foreground fgaccent)) (_ (list :background bg :foreground fg)))) +(defun modus-themes--mode-line-padding () + "Determine mode line padding value. +See `modus-themes--mode-line-attrs'." + (if (natnump modus-themes-mode-line-padding) + modus-themes-mode-line-padding + 6)) ; the default value + (defun modus-themes--mode-line-attrs (fg bg fg-alt bg-alt fg-accent bg-accent border border-3d &optional alt-style fg-distant) "Color combinations for `modus-themes-mode-line'. @@ -3605,7 +3624,8 @@ line's box property. Optional FG-DISTANT should be close to the main background values. It is intended to be used as a distant-foreground property." - (let ((modus-themes-mode-line + (let ((padding (modus-themes--mode-line-padding)) + (modus-themes-mode-line (if (listp modus-themes-mode-line) modus-themes-mode-line ;; translation layer for legacy values @@ -3632,7 +3652,7 @@ property." nil) ((and (memq '3d modus-themes-mode-line) (memq 'padded modus-themes-mode-line)) - (list :line-width 4 + (list :line-width padding :color (cond ((and (memq 'accented modus-themes-mode-line) (memq 'borderless modus-themes-mode-line)) @@ -3644,9 +3664,9 @@ property." :style (when alt-style 'released-button))) ((and (memq 'accented modus-themes-mode-line) (memq 'padded modus-themes-mode-line)) - (list :line-width 6 :color bg-accent)) + (list :line-width padding :color bg-accent)) ((memq 'padded modus-themes-mode-line) - (list :line-width 6 :color bg)) + (list :line-width padding :color bg)) ((memq '3d modus-themes-mode-line) (list :line-width 1 :color @@ -3662,7 +3682,7 @@ property." ((memq 'borderless modus-themes-mode-line) bg) ((memq 'padded modus-themes-mode-line) - (list :line-width 6 :color bg)) + (list :line-width padding :color bg)) (border))) (line (cond ((not (or (memq 'moody modus-themes-mode-line) (memq 'padded modus-themes-mode-line)))