Hi.

I use latest auctex-14.0.6. In Emacs, i use dark color theme.

For a long time I have been annoyed by not being able to see properly
script char ^ and _, like in formulas $x^2$.

Now investigating, in font-latex.el I see:

(defface font-latex-script-char-face
  (let ((font '(:inherit underline)))
    `((((class grayscale) (background light))
       (:foreground "DarkGray" ,@font))
      (((class grayscale) (background dark))
       (:foreground "gray" ,@font))
      (((class color) (background light))
       (:foreground "salmon"))  <<<--- light color in light bg
      (((class color) (background dark))
       (:foreground "DarkRed"))  <<<--- dark color in light bg
      (t (,@font))))
  "Face used for the script chars ^ and _."
  :group 'font-latex-highlighting-faces)

Here, probably a typo exchanging dark and light fg colors.

Also arguments for \textit{...} and \textbf{...} have poor contrast, so I
decided to check all colors.

PS.: To decide if a color is light or dark, one can convert it to HSL (hue
saturation luminance) and compare 3rd number with 0.5:
  (nth 2 (apply 'color-rgb-to-hsl
                   (color-name-to-rgb COLOR-NAME)))

Summarizing the lot of work done:

- replace OliveDrab (dark) by OliveDrad2 (light) in dark bg.
- replace RosyBrown (light) by RosyBrown4 (mid-dark) in light bg.
- replace DarkGray (surprise: it is light) by gray25 (dark) in light bg.
- exchange salmon <-> DarkRed to get proper contrast, as explained.

To ease the job, I created a patch file, attached.

If you agree with these suggestions, someone with commit permissions please
apply them.

best regards

Miguel

-- 
Miguel Vinicius Santini Frasson
mvsfras...@gmail.com
--- /home/sme/.emacs.d/elpa/auctex-14.0.6/font-latex.el	2024-07-25 00:59:09.944791937 -0300
+++ font-latex-proposed.el	2024-07-25 01:04:41.936662931 -0300
@@ -1152,7 +1152,7 @@
       (((class color) (background light))
        (:foreground "DarkOliveGreen" ,@font))
       (((class color) (background dark))
-       (:foreground "OliveDrab" ,@font))
+       (:foreground "OliveDrab2" ,@font))
       (t (,@font))))
   "Face used to highlight text to be typeset in bold."
   :group 'font-latex-highlighting-faces)
@@ -1166,7 +1166,7 @@
       (((class color) (background light))
        (:foreground "DarkOliveGreen" ,@font))
       (((class color) (background dark))
-       (:foreground "OliveDrab" ,@font))
+       (:foreground "OliveDrab2" ,@font))
       (t (,@font))))
   "Face used to highlight text to be typeset in italic."
   :group 'font-latex-highlighting-faces)
@@ -1180,7 +1180,7 @@
       (((class color) (background light))
        (:foreground "DarkOliveGreen" ,@font))
       (((class color) (background dark))
-       (:foreground "OliveDrab" ,@font))
+       (:foreground "OliveDrab2" ,@font))
       (t (,@font))))
   "Face used to highlight text to be underlined."
   :group 'font-latex-highlighting-faces)
@@ -1218,7 +1218,7 @@
       (((class grayscale) (background dark))
        (:foreground "LightGray" ,@font))
       (((class color) (background light))
-       (:foreground "RosyBrown"))
+       (:foreground "RosyBrown4"))
       (((class color) (background dark))
        (:foreground "LightSalmon"))
       (t (,@font))))
@@ -1266,13 +1266,13 @@
 (defface font-latex-script-char-face
   (let ((font '(:inherit underline)))
     `((((class grayscale) (background light))
-       (:foreground "DarkGray" ,@font))
+       (:foreground "gray25" ,@font))
       (((class grayscale) (background dark))
        (:foreground "gray" ,@font))
       (((class color) (background light))
-       (:foreground "salmon"))
-      (((class color) (background dark))
        (:foreground "DarkRed"))
+      (((class color) (background dark))
+       (:foreground "salmon"))
       (t (,@font))))
   "Face used for the script chars ^ and _."
   :group 'font-latex-highlighting-faces)

Reply via email to