Subject: [PATCH] Define dedicated faces for the package.el mode line

From: Protesilaos Stavrou <[email-masked]>
Date: Mon, 23 Jun 2025 09:13:43 +0300

Dear maintainers,

The new mode line format for 'list-packages' reuses existing faces 
instead of defining its own.

This can be a problem for certain themes.

The attached patch defines the relevant faces. Themes can customise 
those to meet their stated goals.

All the best,
Protesilaos (or simple "Prot")

From 285c7f150e4174b48f6f7cddfc7fb8b7181786b7 Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
From: Protesilaos Stavrou <[email-masked]>
Date: Mon, 23 Jun 2025 08:30:48 +0300
Subject: [PATCH] Define dedicated faces for the package.el mode line

* lisp/emacs-lisp/package.el
(package-menu--set-mode-line-format): Apply the faces.
(package-mode-line-total, package-mode-line-installed)
(package-mode-line-to-upgrade, package-mode-line-new): Define
the faces.
---
 lisp/emacs-lisp/package.el | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 9bcffb1df0b..d8b1487dfa8 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -3264,24 +3264,24 @@ package-menu--set-mode-line-format
                (propertize "Total: " 'help-echo total-help)
                (propertize total
                            'help-echo total-help
-                           'face 'font-lock-keyword-face)
+                           'face 'package-mode-line-total)
                " / "
                (propertize "Installed: " 'help-echo installed-help)
                (propertize installed
                            'help-echo installed-help
-                           'face 'package-status-installed)
+                           'face 'package-mode-line-installed)
                " / "
                (propertize "To Upgrade: " 'help-echo upgrade-help)
                (propertize to-upgrade
                            'help-echo upgrade-help
-                           'face 'font-lock-keyword-face)
+                           'face 'package-mode-line-to-upgrade)
                (when (> new 0)
                  (concat
                   " / "
                   (propertize "New: " 'help-echo new-help)
                   (propertize (number-to-string new)
                               'help-echo new-help
-                              'face 'package-status-new)))
+                              'face 'package-mode-line-new)))
                "] "))))))
 
 (define-derived-mode package-menu-mode tabulated-list-mode "Package Menu"
@@ -3727,6 +3727,22 @@ package-mark-delete-line
   "Face used for highlighting in package-menu packages marked to be deleted."
   :version "31.1")
 
+(defface package-mode-line-total nil
+  "Face for the total number of packages displayed on the mode line."
+  :version "31.1")
+
+(defface package-mode-line-installed '((t :inherit package-status-installed))
+  "Face for the number of installed packages displayed on the mode line."
+  :version "31.1")
+
+(defface package-mode-line-to-upgrade '((t :inherit bold))
+  "Face for the number of packages to upgrade displayed on the mode line."
+  :version "31.1")
+
+(defface package-mode-line-new '((t :inherit package-status-new))
+  "Face for the number of new packages displayed on the mode line."
+  :version "31.1")
+
 
 ;;; Package menu printing
 
-- 
2.47.2