Is it possible to have a custom setup for lstlistings for LISP-like languages and have matching parentheses coloured with a same colour taken from a palette?
What I am looking for is something like the minor mode rainbow-delimiters for Emacs, have a look at here:
Suppose you have a palette of 5 colours, then nested parentheses will be coloured by looping through this palette, having 5 alternating colors in the same order.
UPDATE I am providing a little MWE, just showing some listings settings for a lisp-like language (namely CLIPS), I do not know where to begin with colored parentheses.
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{xcolor}
\definecolor{color_1}{RGB}{247, 247, 247}
\definecolor{color_2}{RGB}{186, 33, 33}
\definecolor{color_3}{RGB}{0, 128, 0}
\definecolor{color_4}{RGB}{64, 128, 128}
\definecolor{color_5}{RGB}{170, 34, 255}
\lstdefinelanguage{clips}
{
morekeywords ={deffunction, deftemplate, defrule, deffacts, run,
clear, reset, facts, agenda, nil, initial-fact, assert, retract,
watch, ppdefrule, unwatch, crlf},
sensitive=true,
morecomment=[l]{;},
morestring=[b]",
basicstyle=\ttfamily\small,
numbers=left,
numberstyle=\tiny,
}
\lstnewenvironment{clips-code}
{\lstset{language=clips,
}}
{}
\begin{document}
\begin{clips-code}
(deffunction (a b)
``Simple function''
(if (< a b)
then (printout t a)
else (printout t b)))
\end{clips-code}
\end{document}
.tex
file to work with. Do you want us all to retype the code snippet you've provided as a picture?listings
a bit. Basically, you need to use a counter to keep track of the nesting level, and typeset each parenthesis in a colour corresponding to the current value of that counter. I'd be happy to look into it (when I get more time), but you need to show some effort: as jon asked, please add a minimal working example (MWE).