[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/spacious-padding 5372d4d6f7 5/6: Abstract how face widt
From: |
ELPA Syncer |
Subject: |
[elpa] externals/spacious-padding 5372d4d6f7 5/6: Abstract how face widths are returned |
Date: |
Thu, 16 Nov 2023 03:58:40 -0500 (EST) |
branch: externals/spacious-padding
commit 5372d4d6f79c6bc8e31a84721747cd990a358da7
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Abstract how face widths are returned
---
spacious-padding.el | 56 ++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 38 insertions(+), 18 deletions(-)
diff --git a/spacious-padding.el b/spacious-padding.el
index 9171c4f9c4..d178b6a461 100644
--- a/spacious-padding.el
+++ b/spacious-padding.el
@@ -88,33 +88,53 @@ following:
:package-version '(spacious-padding . "0.2.0")
:group 'spacious-padding)
+(defvar spacious-padding--mode-line-faces
+ '(mode-line mode-line-active mode-line-inactive mode-line-highlight)
+ "Mode line faces relevant to `spacious-padding-mode'.")
+
+(defvar spacious-padding--header-line-faces
+ '(header-line header-line-highlight)
+ "Header line faces relevant to `spacious-padding-mode'.")
+
+;; TODO 2023-11-16: Cover `tab-line-mode'.
+(defvar spacious-padding--tab-faces
+ '(tab-bar tab-bar-tab tab-bar-tab-inactive)
+ "Tab faces relevant to `spacious-padding-mode'.")
+
+(defun spacious-padding--get-face-width (face)
+ "Return width of FACE from `spacious-padding-widths'."
+ (cond
+ ((memq face spacious-padding--mode-line-faces)
+ (plist-get spacious-padding-widths :mode-line-width))
+ ((memq face spacious-padding--header-line-faces)
+ (plist-get spacious-padding-widths :header-line-width))
+ ((memq face spacious-padding--tab-faces)
+ (plist-get spacious-padding-widths :tab-width))
+ (t (error "`%s' is not relevant to `spacious-padding-mode'" face))))
+
+(defun spacious-padding-set-face-box-padding (face fallback)
+ "Return appropriate face attributes for FACE with FALLBACK face background."
+ (list :box
+ (list
+ :line-width (spacious-padding--get-face-width face)
+ :color (face-background face nil fallback)
+ :style nil)))
+
(defun spacious-padding-set-invisible-dividers (_theme)
"Make window dividers for THEME invisible."
(let ((bg-main (face-background 'default))
(fg-main (face-foreground 'default)))
(custom-set-faces
`(fringe ((t :background ,bg-main)))
- `(header-line ((t :box ( :line-width ,(plist-get spacious-padding-widths
:header-line-width)
- :color ,(face-background 'header-line nil 'default)
- :style nil))))
+ `(header-line ((t ,@(spacious-padding-set-face-box-padding 'header-line
'default))))
`(header-line-highlight ((t :box (:color ,fg-main))))
- `(mode-line ((t :box ( :line-width ,(plist-get spacious-padding-widths
:mode-line-width)
- :color ,(face-background 'mode-line)
- :style nil))))
+ `(mode-line ((t ,@(spacious-padding-set-face-box-padding 'mode-line
'default))))
;; We cannot use :inherit mode-line because it does not get our version
of it...
- `(mode-line-active ((t :box ( :line-width ,(plist-get
spacious-padding-widths :mode-line-width)
- :color ,(face-background 'mode-line-active nil
'mode-line)
- :style nil))))
- `(mode-line-inactive ((t :box ( :line-width ,(plist-get
spacious-padding-widths :mode-line-width)
- :color ,(face-background
'mode-line-inactive)
- :style nil))))
+ `(mode-line-active ((t ,@(spacious-padding-set-face-box-padding
'mode-line-active 'mode-line))))
+ `(mode-line-inactive ((t ,@(spacious-padding-set-face-box-padding
'mode-line-inactive 'mode-line))))
`(mode-line-highlight ((t :box (:color ,fg-main))))
- `(tab-bar-tab ((t :box ( :line-width ,(plist-get spacious-padding-widths
:tab-width)
- :color ,(face-background 'tab-bar-tab nil
'tab-bar)
- :style nil))))
- `(tab-bar-tab-inactive ((t :box ( :line-width ,(plist-get
spacious-padding-widths :tab-width)
- :color ,(face-background
'tab-bar-tab-inactive nil 'tab-bar)
- :style nil))))
+ `(tab-bar-tab ((t ,@(spacious-padding-set-face-box-padding 'tab-bar-tab
'tab-bar))))
+ `(tab-bar-tab-inactive ((t ,@(spacious-padding-set-face-box-padding
'tab-bar-tab-inactive 'tab-bar))))
`(window-divider ((t :background ,bg-main :foreground ,bg-main)))
`(window-divider-first-pixel ((t :background ,bg-main :foreground
,bg-main)))
`(window-divider-last-pixel ((t :background ,bg-main :foreground
,bg-main))))))
- [elpa] externals/spacious-padding updated (058c2e2c31 -> b84b9674a6), ELPA Syncer, 2023/11/16
- [elpa] externals/spacious-padding 755699da22 1/6: Add spacious-padding to the 'faces' group as well, ELPA Syncer, 2023/11/16
- [elpa] externals/spacious-padding ac518dbe3b 2/6: Expand doc string of spacious-padding-widths, ELPA Syncer, 2023/11/16
- [elpa] externals/spacious-padding 5372d4d6f7 5/6: Abstract how face widths are returned,
ELPA Syncer <=
- [elpa] externals/spacious-padding a5bfb9b5fe 4/6: Move the minor mode definition further down, ELPA Syncer, 2023/11/16
- [elpa] externals/spacious-padding 353e817fb9 3/6: Cover mode-line-highlight and header-line-highlight faces, ELPA Syncer, 2023/11/16
- [elpa] externals/spacious-padding b84b9674a6 6/6: Remove background from display-line-numbers-mode, ELPA Syncer, 2023/11/16