Skip to content

Instantly share code, notes, and snippets.

@Cheesebaron
Created December 8, 2014 01:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cheesebaron/d840258a9c41619dbdf0 to your computer and use it in GitHub Desktop.
Save Cheesebaron/d840258a9c41619dbdf0 to your computer and use it in GitHub Desktop.
A solarized light theme for LaTeX C# code listings
\usepackage{listings}
\usepackage{etoolbox}
\usepackage{color}
\definecolor{base0}{RGB}{131,148,150}
\definecolor{base01}{RGB}{88,110,117}
\definecolor{base2}{RGB}{238,232,213}
\definecolor{sgreen}{RGB}{133,153,0}
\definecolor{sblue}{RGB}{38,138,210}
\definecolor{scyan}{RGB}{42,161,151}
\definecolor{smagenta}{RGB}{211,54,130}
\newcommand\digitstyle{\color{smagenta}}
\newcommand\symbolstyle{\color{base01}}
\makeatletter
\newcommand{\ProcessDigit}[1]
{%
\ifnum\lst@mode=\lst@Pmode\relax%
{\digitstyle #1}%
\else
#1%
\fi
}
\makeatother
\lstdefinestyle{solarizedcsharp} {
language=[Sharp]C,
frame=lr,
linewidth=160mm,
breaklines=true,
tabsize=2,
numbers=left,
numbersep=5pt,
firstnumber=auto,
numberstyle=\tiny\ttfamily\color{base0},
rulecolor=\color{base2},
basicstyle=\footnotesize\ttfamily,
commentstyle=\color{base01},
morecomment=[s][\color{base01}]{/*+}{*/},
morecomment=[s][\color{base01}]{/*-}{*/},
morekeywords={ abstract, event, new, struct,
as, explicit, null, switch,
base, extern, object, this,
bool, false, operator, throw,
break, finally, out, true,
byte, fixed, override, try,
case, float, params, typeof,
catch, for, private, uint,
char, foreach, protected, ulong,
checked, goto, public, unchecked,
class, if, readonly, unsafe,
const, implicit, ref, ushort,
continue, in, return, using,
decimal, int, sbyte, virtual,
default, interface, sealed, volatile,
delegate, internal, short, void,
do, is, sizeof, while,
double, lock, stackalloc,
else, long, static,
enum, namespace, string, var},
keywordstyle=\bfseries\color{sgreen},
showstringspaces=false,
stringstyle=\color{scyan},
identifierstyle=\color{sblue},
extendedchars=true,
literate=
{0}{{{\ProcessDigit{0}}}}1
{1}{{{\ProcessDigit{1}}}}1
{2}{{{\ProcessDigit{2}}}}1
{3}{{{\ProcessDigit{3}}}}1
{4}{{{\ProcessDigit{4}}}}1
{5}{{{\ProcessDigit{5}}}}1
{6}{{{\ProcessDigit{6}}}}1
{7}{{{\ProcessDigit{7}}}}1
{8}{{{\ProcessDigit{8}}}}1
{9}{{{\ProcessDigit{9}}}}1
{\}}{{\symbolstyle{\}}}}1
{\{}{{\symbolstyle{\{}}}1
{(}{{\symbolstyle{(}}}1
{)}{{\symbolstyle{)}}}1
{=}{{\symbolstyle{$=$}}}1
{;}{{\symbolstyle{$;$}}}1
{>}{{\symbolstyle{$>$}}}1
{<}{{\symbolstyle{$<$}}}1
{\%}{{\symbolstyle{$\%$}}}1,
}
\lstset{escapechar=@,style=solarizedcsharp}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment