Subject: bug#51295: 28.0.60; [PATCH] Update ANSI colors in themes to use new faces

From: Jim Porter <[email-masked]>
Date: Tue, 19 Oct 2021 16:18:18 -0700

In bug#50179, I added support for bright ANSI colors and changed the way 
the colors are defined to use faces instead of a vector of color values. 
However, I neglected to update the themes to take this into account. 
Attached is a patch that does this. Note: I only updated themes which 
defined `ansi-color-names-vector' (except for the Modus themes, which 
were already up-to-date).

For the most part, I just converted the definitions and added some 
hopefully-reasonable bright variants, but I did tweak the colors here 
and there to ensure 1) a reasonably-visible difference between normal 
and bright colors, and 2) that the color values roughly matched their 
names (mainly for wombat).

I can provide screenshots if it would help, but rainbow-mode on GNU ELPA 
should hopefully make it fairly easy to review the colors.
From ba7154fd60ebc68b043fe1424c5399e988ae6a53 Mon Sep 17 00:00:00 2001
From: Jim Porter <[email-masked]>
Date: Tue, 19 Oct 2021 16:01:15 -0700
Subject: [PATCH] Convert ANSI color definitions in themes to use faces (e.g.
 'ansi-color-red')

* etc/themes/dichromacy-theme.el:
* etc/themes/leuven-theme.el:
* etc/themes/misterioso-theme.el:
* etc/themes/tango-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/wombat-theme.el: Convert ANSI color definitions to
use faces.
---
 etc/themes/dichromacy-theme.el | 34 +++++++++++++++++++++++++++------
 etc/themes/leuven-theme.el     | 25 ++++++++++++++++++------
 etc/themes/misterioso-theme.el | 33 ++++++++++++++++++++++++++------
 etc/themes/tango-dark-theme.el | 35 +++++++++++++++++++++++++++-------
 etc/themes/tango-theme.el      | 35 +++++++++++++++++++++++++++-------
 etc/themes/wombat-theme.el     | 24 +++++++++++++++++------
 6 files changed, 148 insertions(+), 38 deletions(-)

diff --git a/etc/themes/dichromacy-theme.el b/etc/themes/dichromacy-theme.el
index 09f4454f9b..c59b24bef5 100644
--- a/etc/themes/dichromacy-theme.el
+++ b/etc/themes/dichromacy-theme.el
@@ -113,12 +113,34 @@ dichromacy
    `(flyspell-duplicate ((,class (:weight unspecified :foreground unspecified
 				  :slant unspecified :underline ,orange))))
    `(flyspell-incorrect ((,class (:weight unspecified :foreground unspecified
-				  :slant unspecified :underline ,redpurple)))))
-
-  (custom-theme-set-variables
-   'dichromacy
-   `(ansi-color-names-vector ["black" ,vermillion ,bluegreen ,yellow
-			      ,blue ,redpurple ,skyblue "white"])))
+				  :slant unspecified :underline ,redpurple))))
+   ;; ANSI color
+   `(ansi-color-black ((,class (:background "black" :foreground "black"))))
+   `(ansi-color-red ((,class (:background ,vermillion
+			      :foreground ,vermillion))))
+   `(ansi-color-green ((,class (:background ,bluegreen
+				:foreground ,bluegreen))))
+   `(ansi-color-yellow ((,class (:background ,yellow :foreground ,yellow))))
+   `(ansi-color-blue ((,class (:background ,blue :foreground ,blue))))
+   `(ansi-color-magenta ((,class (:background ,redpurple
+				  :foreground ,redpurple))))
+   `(ansi-color-cyan ((,class (:background ,skyblue :foreground ,skyblue))))
+   `(ansi-color-white ((,class (:background "gray90" :foreground "gray90"))))
+   `(ansi-color-bright-black ((,class (:background "black"
+				       :foreground "black"))))
+   `(ansi-color-bright-red ((,class (:background ,vermillion
+				     :foreground ,vermillion))))
+   `(ansi-color-bright-green ((,class (:background ,bluegreen
+				       :foreground ,bluegreen))))
+   `(ansi-color-bright-yellow ((,class (:background ,yellow
+					:foreground ,yellow))))
+   `(ansi-color-bright-blue ((,class (:background ,blue :foreground ,blue))))
+   `(ansi-color-bright-magenta ((,class (:background ,redpurple
+					 :foreground ,redpurple))))
+   `(ansi-color-bright-cyan ((,class (:background ,skyblue
+				      :foreground ,skyblue))))
+   `(ansi-color-bright-white ((,class (:background "gray90"
+				       :foreground "gray90"))))))
 
 (provide-theme 'dichromacy)
 
diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el
index f643dd560c..95ec303f70 100644
--- a/etc/themes/leuven-theme.el
+++ b/etc/themes/leuven-theme.el
@@ -287,6 +287,25 @@ leuven
    `(message-header-xheader ((,class ,mail-header-other)))
    `(message-mml ((,class (:foreground "forest green"))))
 
+   ;; ANSI colors.
+   `(ansi-color-bold ((,class (:weight bold))))
+   `(ansi-color-black ((,class (:foreground "black" :background "black"))))
+   `(ansi-color-red ((,class (:foreground "red3" :background "red3"))))
+   `(ansi-color-green ((,class (:foreground "forest green" :background "forest green"))))
+   `(ansi-color-yellow ((,class (:foreground "yellow3" :background "yellow3"))))
+   `(ansi-color-blue ((,class (:foreground "blue" :background "blue"))))
+   `(ansi-color-magenta ((,class (:foreground "magenta3" :background "magenta3"))))
+   `(ansi-color-cyan ((,class (:foreground "deep sky blue" :background "deep sky blue"))))
+   `(ansi-color-white ((,class (:foreground "gray60" :background "gray60"))))
+   `(ansi-color-bright-black ((,class (:foreground "gray30" :background "gray30"))))
+   `(ansi-color-bright-red ((,class (:foreground "red1" :background "red1"))))
+   `(ansi-color-bright-green ((,class (:foreground "lime green" :background "lime green"))))
+   `(ansi-color-bright-yellow ((,class (:foreground "yellow2" :background "yellow2"))))
+   `(ansi-color-bright-blue ((,class (:foreground "dodger blue" :background "dodger blue"))))
+   `(ansi-color-bright-magenta ((,class (:foreground "magenta" :background "magenta"))))
+   `(ansi-color-bright-cyan ((,class (:foreground "sky blue" :background "sky blue"))))
+   `(ansi-color-bright-white ((,class (:foreground "gray80" :background "gray80"))))
+
    ;; Diff.
    `(diff-added ((,class ,diff-added)))
    `(diff-changed ((,class ,diff-changed)))
@@ -1035,12 +1054,6 @@ leuven
   ;; highlight-sexp-mode.
   '(hl-sexp-background-color "#efebe9")
 
-  '(ansi-color-faces-vector
-    [default default default italic underline success warning error])
-
-  ;; Colors used in Shell mode.
-  '(ansi-color-names-vector
-    ["black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50"])
  )
 
 ;;;###autoload
diff --git a/etc/themes/misterioso-theme.el b/etc/themes/misterioso-theme.el
index e7a66c5650..26a5946d30 100644
--- a/etc/themes/misterioso-theme.el
+++ b/etc/themes/misterioso-theme.el
@@ -101,12 +101,33 @@ misterioso
    `(message-header-subject ((,class (:foreground "#dbdb95"))))
    `(message-header-to ((,class (:foreground "#00ede1"))))
    `(message-cited-text ((,class (:foreground "#74af68"))))
-   `(message-separator ((,class (:foreground "#23d7d7"))))))
-
-(custom-theme-set-variables
- 'misterioso
- '(ansi-color-names-vector ["#2d3743" "#ff4242" "#74af68" "#dbdb95"
-			    "#34cae2" "#008b8b" "#00ede1" "#e1e1e0"]))
+   `(message-separator ((,class (:foreground "#23d7d7"))))
+   ;; ANSI colors
+   `(ansi-color-black ((,class (:background "#2d3743" :foreground "#2d3743"))))
+   `(ansi-color-red ((,class (:background "#da3938" :foreground "#da3938"))))
+   `(ansi-color-green ((,class (:background "#74af68" :foreground "#74af68"))))
+   `(ansi-color-yellow ((,class (:background "#dbdb95" :foreground "#dbdb95"))))
+   `(ansi-color-blue ((,class (:background "#34cae2" :foreground "#34cae2"))))
+   `(ansi-color-magenta ((,class (:background "#b33c97"
+				  :foreground "#b33c97"))))
+   `(ansi-color-cyan ((,class (:background "#008b8b" :foreground "#008b8b"))))
+   `(ansi-color-white ((,class (:background "#e1e1e0" :foreground "#e1e1e0"))))
+   `(ansi-color-bright-black ((,class (:background "#415160"
+                                       :foreground "#415160"))))
+   `(ansi-color-bright-red ((,class (:background "#ff4242"
+                                     :foreground "#ff4242"))))
+   `(ansi-color-bright-green ((,class (:background "#74cd65"
+                                       :foreground "#74cd65"))))
+   `(ansi-color-bright-yellow ((,class (:background "#ffad29"
+                                        :foreground "#ffad29"))))
+   `(ansi-color-bright-blue ((,class (:background "#59e9ff"
+                                      :foreground "#59e9ff"))))
+   `(ansi-color-bright-magenta ((,class (:background "#ed74cd"
+                                         :foreground "#ed74cd"))))
+   `(ansi-color-bright-cyan ((,class (:background "#00ede1"
+                                      :foreground "#00ede1"))))
+   `(ansi-color-bright-white ((,class (:background "#eeeeec"
+                                       :foreground "#eeeeec"))))))
 
 (provide-theme 'misterioso)
 
diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index 1a33676eba..fe4a24746e 100644
--- a/etc/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
@@ -45,7 +45,9 @@ tango-dark
       (alum-4 "#888a85") (alum-5 "#555753") (alum-6 "#2e3436")
       ;; Not in Tango palette; used for better contrast.
       (cham-0 "#b4fa70") (blue-0 "#8cc4ff") (plum-0 "#e9b2e3")
-      (red-0 "#ff4b4b")  (alum-5.5 "#41423f") (alum-7 "#212526"))
+      (red-0 "#ff4b4b")  (alum-5.5 "#41423f") (alum-7 "#212526")
+      ;; Not in Tango palette; used for ANSI cyan.
+      (cyan-1 "#34e2e2") (cyan-2 "#06989a"))
 
   (custom-theme-set-faces
    'tango-dark
@@ -162,12 +164,31 @@ tango-dark
    `(semantic-decoration-on-unparsed-includes
      ((,class (:background ,alum-5.5))))
    `(semantic-tag-boundary-face ((,class (:overline ,blue-1))))
-   `(semantic-unmatched-syntax-face ((,class (:underline ,red-1)))))
-
-  (custom-theme-set-variables
-   'tango-dark
-   `(ansi-color-names-vector [,alum-7 ,red-0 ,cham-0 ,butter-1
-			      ,blue-1 ,plum-1 ,blue-0 ,alum-1])))
+   `(semantic-unmatched-syntax-face ((,class (:underline ,red-1))))
+   ;; ANSI colors
+   `(ansi-color-black ((,class (:background ,alum-7 :foreground ,alum-7))))
+   `(ansi-color-red ((,class (:background ,red-1 :foreground ,red-1))))
+   `(ansi-color-green ((,class (:background ,cham-2 :foreground ,cham-2))))
+   `(ansi-color-yellow ((,class (:background ,butter-2 :foreground ,butter-2))))
+   `(ansi-color-blue ((,class (:background ,blue-2 :foreground ,blue-2))))
+   `(ansi-color-magenta ((,class (:background ,plum-1 :foreground ,plum-1))))
+   `(ansi-color-cyan ((,class (:background ,cyan-2 :foreground ,cyan-2))))
+   `(ansi-color-white ((,class (:background ,alum-2 :foreground ,alum-2))))
+   `(ansi-color-bright-black ((,class (:background ,alum-5
+				       :foreground ,alum-5))))
+   `(ansi-color-bright-red ((,class (:background ,red-0 :foreground ,red-0))))
+   `(ansi-color-bright-green ((,class (:background ,cham-1
+				       :foreground ,cham-1))))
+   `(ansi-color-bright-yellow ((,class (:background ,butter-1
+					:foreground ,butter-1))))
+   `(ansi-color-bright-blue ((,class (:background ,blue-0
+				      :foreground ,blue-0))))
+   `(ansi-color-bright-magenta ((,class (:background ,plum-0
+					 :foreground ,plum-0))))
+   `(ansi-color-bright-cyan ((,class (:background ,cyan-1
+				      :foreground ,cyan-1))))
+   `(ansi-color-bright-white ((,class (:background ,alum-1
+				       :foreground ,alum-1))))))
 
 (provide-theme 'tango-dark)
 
diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el
index 9ee2619ce2..5c429b0b70 100644
--- a/etc/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
@@ -44,7 +44,9 @@ tango
       (alum-1 "#eeeeec") (alum-2 "#d3d7cf") (alum-3 "#babdb6")
       (alum-4 "#888a85") (alum-5 "#5f615c") (alum-6 "#2e3436")
       ;; Not in Tango palette; used for better contrast.
-      (cham-4 "#346604") (blue-0 "#8cc4ff") (orange-4 "#b35000"))
+      (cham-4 "#346604") (blue-0 "#8cc4ff") (orange-4 "#b35000")
+      ;; Not in Tango palette; used for ANSI cyan.
+      (cyan-1 "#34e2e2") (cyan-2 "#06989a"))
 
   (custom-theme-set-faces
    'tango
@@ -145,12 +147,31 @@ tango
    `(semantic-decoration-on-unparsed-includes
      ((,class (:underline  ,orange-3))))
    `(semantic-tag-boundary-face ((,class (:overline   ,blue-1))))
-   `(semantic-unmatched-syntax-face ((,class (:underline  ,red-1)))))
-
-  (custom-theme-set-variables
-   'tango
-   `(ansi-color-names-vector [,alum-6 ,red-3 ,cham-3 ,butter-3
-				      ,blue-3 ,plum-3 ,blue-1 ,alum-1])))
+   `(semantic-unmatched-syntax-face ((,class (:underline  ,red-1))))
+   ;; ANSI colors
+   `(ansi-color-black ((,class (:background ,alum-6 :foreground ,alum-6))))
+   `(ansi-color-red ((,class (:background ,red-2 :foreground ,red-2))))
+   `(ansi-color-green ((,class (:background ,cham-3 :foreground ,cham-3))))
+   `(ansi-color-yellow ((,class (:background ,butter-3 :foreground ,butter-3))))
+   `(ansi-color-blue ((,class (:background ,blue-2 :foreground ,blue-2))))
+   `(ansi-color-magenta ((,class (:background ,plum-2 :foreground ,plum-2))))
+   `(ansi-color-cyan ((,class (:background ,cyan-2 :foreground ,cyan-2))))
+   `(ansi-color-white ((,class (:background ,alum-2 :foreground ,alum-2))))
+   `(ansi-color-bright-black ((,class (:background ,alum-5
+				       :foreground ,alum-5))))
+   `(ansi-color-bright-red ((,class (:background ,red-1 :foreground ,red-1))))
+   `(ansi-color-bright-green ((,class (:background ,cham-1
+				       :foreground ,cham-1))))
+   `(ansi-color-bright-yellow ((,class (:background ,butter-1
+					:foreground ,butter-1))))
+   `(ansi-color-bright-blue ((,class (:background ,blue-1
+				      :foreground ,blue-1))))
+   `(ansi-color-bright-magenta ((,class (:background ,plum-1
+					 :foreground ,plum-1))))
+   `(ansi-color-bright-cyan ((,class (:background ,cyan-1
+				      :foreground ,cyan-1))))
+   `(ansi-color-bright-white ((,class (:background ,alum-1
+				       :foreground ,alum-1))))))
 
 (provide-theme 'tango)
 
diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el
index 922114fb64..d769c33721 100644
--- a/etc/themes/wombat-theme.el
+++ b/etc/themes/wombat-theme.el
@@ -95,12 +95,24 @@ wombat
    `(message-header-subject ((,class (:foreground "#cae682"))))
    `(message-header-to ((,class (:foreground "#cae682"))))
    `(message-cited-text ((,class (:foreground "#99968b"))))
-   `(message-separator ((,class (:foreground "#e5786d" :weight bold))))))
-
-(custom-theme-set-variables
- 'wombat
- '(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682"
-			    "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"]))
+   `(message-separator ((,class (:foreground "#e5786d" :weight bold))))
+   ;; ANSI colors
+   `(ansi-color-black ((,class (:background "#242424" :foreground "#242424"))))
+   `(ansi-color-red ((,class (:background "#b85149" :foreground "#b85149"))))
+   `(ansi-color-green ((,class (:background "#92a65e" :foreground "#92a65e"))))
+   `(ansi-color-yellow ((,class (:background "#ccaa8f" :foreground "#ccaa8f"))))
+   `(ansi-color-blue ((,class (:background "#5b98c2" :foreground "#5b98c2"))))
+   `(ansi-color-magenta ((,class (:background "#64619a" :foreground "#64619a"))))
+   `(ansi-color-cyan ((,class (:background "#3f9f9e" :foreground "#3f9f9e"))))
+   `(ansi-color-white ((,class (:background "#f6f3e8" :foreground "#f6f3e8"))))
+   `(ansi-color-bright-black ((,class (:background "#444444" :foreground "#444444"))))
+   `(ansi-color-bright-red ((,class (:background "#e5786d" :foreground "#e5786d"))))
+   `(ansi-color-bright-green ((,class (:background "#95e454" :foreground "#95e454"))))
+   `(ansi-color-bright-yellow ((,class (:background "#edc4a3" :foreground "#edc4a3"))))
+   `(ansi-color-bright-blue ((,class (:background "#8ac6f2" :foreground "#8ac6f2"))))
+   `(ansi-color-bright-magenta ((,class (:background "#a6a1de" :foreground "#a6a1de"))))
+   `(ansi-color-bright-cyan ((,class (:background "#70cecc" :foreground "#70cecc"))))
+   `(ansi-color-bright-white ((,class (:background "#ffffff" :foreground "#ffffff"))))))
 
 (provide-theme 'wombat)
 
-- 
2.25.1