\ProvidesPackage{packages/sleek-listings}[2023/09/18 v1.2.1 Sleek Listings]

%%%%%%%%%%%%
% Settings %
%%%%%%%%%%%%

\RequirePackage[scaled=0.95]{inconsolata}
\RequirePackage{listings}
\RequirePackage{xcolor}

%%%%%%%%%%
% Styles %
%%%%%%%%%%

\lstdefinestyle{default}{
    breaklines=true,
    breakatwhitespace=true,
    columns=fixed,
    extendedchars=true,
    inputencoding=utf8,
    keepspaces,
    showstringspaces=false,
    tabsize=4,
    upquote=true,
    %%%%%
    aboveskip=\baselineskip,
    belowskip=\smallskipamount,
    captionpos=b,
    framerule=0.1em,
    %%%%%
    basicstyle=\small\ttfamily,
    numberstyle=\small\ttfamily
}

\lstset{
    style=default,
    literate={
        {á}{{\'a}}1  {é}{{\'e}}1  {í}{{\'i}}1 {ó}{{\'o}}1  {ú}{{\'u}}1
        {Á}{{\'A}}1  {É}{{\'E}}1  {Í}{{\'I}}1 {Ó}{{\'O}}1  {Ú}{{\'U}}1
        {à}{{\`a}}1  {è}{{\`e}}1  {ì}{{\`i}}1 {ò}{{\`o}}1  {ù}{{\`u}}1
        {À}{{\`A}}1  {È}{{\'E}}1  {Ì}{{\`I}}1 {Ò}{{\`O}}1  {Ù}{{\`U}}1
        {ä}{{\"a}}1  {ë}{{\"e}}1  {ï}{{\"i}}1 {ö}{{\"o}}1  {ü}{{\"u}}1
        {Ä}{{\"A}}1  {Ë}{{\"E}}1  {Ï}{{\"I}}1 {Ö}{{\"O}}1  {Ü}{{\"U}}1
        {â}{{\^a}}1  {ê}{{\^e}}1  {î}{{\^i}}1 {ô}{{\^o}}1  {û}{{\^u}}1
        {Â}{{\^A}}1  {Ê}{{\^E}}1  {Î}{{\^I}}1 {Ô}{{\^O}}1  {Û}{{\^U}}1
        {œ}{{\oe}}1  {Œ}{{\OE}}1  {æ}{{\ae}}1 {Æ}{{\AE}}1  {ß}{{\ss}}1
        {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1  {Ø}{{\O}}1   {å}{{\r a}}1
        {Å}{{\r A}}1 {ã}{{\~a}}1  {õ}{{\~o}}1 {Ã}{{\~A}}1  {Õ}{{\~O}}1
        {ñ}{{\~n}}1  {Ñ}{{\~N}}1
    }
}

\lstdefinestyle{numbered}{
    style=default,
    numbers=left
}

\lstdefinestyle{framed}{
    style=default,
    frame=single,
    framesep=0em,
    rulesep=0em,
    xleftmargin=0.75em,
    xrightmargin=0.75em,
    framexleftmargin=0.75em,
    framexrightmargin=0.75em,
    framextopmargin=1ex,
    framexbottommargin=1ex
}

\lstdefinestyle{framednumbered}{
    style=framed,
    xleftmargin=2.75em,
    framexleftmargin=2.75em,
    numbers=left,
    numbersep=1em
}

\lstdefinestyle{ruled}{
    style=framed,
    frame=tb,
    xleftmargin=0em,
    xrightmargin=0em,
    framexleftmargin=0em,
    framexrightmargin=0em
}

\lstdefinestyle{rulednumbered}{
    style=ruled,
    numbers=left
}

%%%%%%%%%%
% Colors %
%%%%%%%%%%

\definecolor{ForestGreen}{HTML}{228B22}
\definecolor{TrueBlue}{HTML}{0000FF}
\definecolor{VeronicaPurple}{HTML}{A020F0}
\definecolor{JustGray}{HTML}{7F7F7F}

\lstdefinestyle{colorful}{
    commentstyle=\color{ForestGreen},
    keywordstyle=[1]{\color{TrueBlue}},
    keywordstyle=[2]{\color{VeronicaPurple}},
    stringstyle=\color{JustGray},
    emphstyle=\bfseries
}

%%%%%%%%%%%%%
% Languages %
%%%%%%%%%%%%%

\lstdefinelanguage{latex}{
    language=[LaTeX]TeX,
    morekeywords={RequirePackage},
    style=colorful
}

\lstdefinelanguage{c*}{
    language=C,
    morekeywords={},
    style=colorful
}

\lstdefinelanguage{cpp*}{
    language=C++,
    morekeywords={std},
    style=colorful
}

\lstdefinelanguage{matlab*}{
    language=matlab,
    morekeywords={clearvars, numel},
    style=colorful
}

\lstdefinelanguage{python*}{
    language=python,
    morekeywords=[1]{with, as},
    style=colorful
}

\lstdefinelanguage{java*}{
    language=java,
    morekeywords={},
    style=colorful
}

\lstdefinelanguage{scheme}{
    alsoletter={!,?,+,-,*,/,<,=,>,\#},
    literate=*{`}{{`}}{1},
    morecomment=[l]{;},
    morecomment=[s]{\#|}{|\#},
    morestring=[b]",
    morekeywords=[1]{
        define, lambda, let, let*, letrec,
        eval, read, print, quote, unquote,
        list, list*, cons, append, car, cdr, caar, cadr, cdar, cddr, cadar, caddr,
        length, reverse, range, member, flatten, filter, count,
        eq?, eqv?, equal?, number?, boolean?, zero?, even?, odd?, pair?, list?, null?, symbol?, procedure?, string?,
        if, cond, else,
        map, apply,
        import, export, require,
        raise, error,
        exit
    },
    morekeywords=[2]{
        +, -, *, /, <, =, >, <=, >=,
        and, or, not,
        quotient, modulo, expt, sqrt
    },
    sensitive,
    style=colorful
}

\endinput
