Hi I use a dark theme in Emacs. For a long time I have been annoyed by not being able to see script chars ^ or _ (dark red in dark background) like in $x^2$.
Reading font-latex.el I realized that face definition for `font-latex-script-char-face' has the following: (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")) <<<------ salmon is light color (((class color) (background dark)) (:foreground "DarkRed")) <<<------- DarkRed is dark color (t (,@font)))) "Face used for the script chars ^ and _." :group 'font-latex-highlighting-faces) So it uses light color (salmon) in light background and dark color (DarkRed) in dark background, probably a typo exchanging colors (it should be the other way around). Also, italic and bold faces (arguments of \textit and \textbf) have poor contrast in dark color themes (OliveDrab, a dark olive-like color in dark background), so I decided to check all faces in font-latex.el. After a lot of work, I can summarize it as: - replace OliveDrab (dark) by OliveDrab2 (light) in dark background. - replace RosyBrown (light) by RosyBrown4 (mid-dark) in light background. - replace DarkGray (surprise: it is light!!!) by gray25 (dark) in light background. - exchange DarkRed <-> salmon to get proper contrast. PS.: Dark colors have luminance < 0.5. To compute color luminance, convert to HSL (hue saturation luminance) and get 3rd arg: (nth 2 (apply 'color-rgb-to-hsl (color-name-to-rgb COLOR-NAME))) To help, I created a patch file for font-latex.el for auctex-14.0.6, attached. 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)