From f5bf51c2a1a7664e7a39c279aa00938d698a41cf Mon Sep 17 00:00:00 2001
From: MZuenni <michi.zuendorf@gmail.com>
Date: Thu, 2 Mar 2023 13:52:36 +0100
Subject: more colors

---
 latexHeaders/code.sty | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

(limited to 'latexHeaders/code.sty')

diff --git a/latexHeaders/code.sty b/latexHeaders/code.sty
index 5c39be5..d35221b 100644
--- a/latexHeaders/code.sty
+++ b/latexHeaders/code.sty
@@ -12,10 +12,11 @@
 %\colorlet{string}{safeRed}
 %\colorlet{comment}{safeGreen}
 %\colorlet{identifier}{black}
-\definecolor{keyword}{HTML}{2750A0}
+\definecolor{type}{HTML}{2750A0}
 \definecolor{string}{HTML}{7B3294}
 \definecolor{comment}{HTML}{1A9641}
 \definecolor{identifier}{HTML}{000000}
+\definecolor{keyword}{HTML}{900000}
 
 % Source code listings.
 \usepackage[scaled=0.80]{beramono}
@@ -33,6 +34,7 @@
 	numberblanklines=true,
 	postbreak=\space,
 	tabsize=2,
+	upquote=true,
 	basicstyle=\ttfamily\normalsize,
 	showspaces=false,
 	showstringspaces=false,
@@ -41,18 +43,29 @@
 	stringstyle=\color{string}\bfseries,
 	commentstyle=\color{comment}\bfseries\itshape,
 	identifierstyle=\color{identifier},
+	directivestyle=\color{keyword}\bfseries,
+	emph={auto, int, long, long long, float, double, long double, char, bool, ll, ld, lll, __int128, __float128, true, false, nullptr, INF, inf, EPS, eps},
+	emphstyle=\color{type}\bfseries,
 	frame=trbl,
 	aboveskip=3pt,
 	belowskip=3pt,
-	deletestring=[b]{'},%lose char heighlighting but win digit separator
-	morekeywords={ll, ld, lll, __int128, __float128},
+	deletestring=[b]{'},%fix digit separator but break char highlighting (fixed again with literate)
 	escapechar=@
 	%moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}	
 }
 
+\newcommand{\formatChar}[1]{{\color{string}\bfseries\textquotesingle{}#1\textquotesingle{}}}
 
-% Listings doesn't support UTF8. This is just enough for German umlauts.
+% Listings doesn't support UTF8. This is just enough for German umlauts. and commonly used chars
 \lstset{literate=%
+  {'a'}{{\formatChar{a}}}3
+  {'z'}{{\formatChar{z}}}3
+  {'A'}{{\formatChar{A}}}3
+  {'Z'}{{\formatChar{Z}}}3
+  {'0'}{{\formatChar{0}}}3
+  {'1'}{{\formatChar{1}}}3
+  {'\$'}{{\formatChar{\$}}}3
+  {'\#'}{{\formatChar{\#}}}3
   {Ö}{{\"O}}1
   {Ä}{{\"A}}1
   {Ü}{{\"U}}1
-- 
cgit v1.2.3

