Starting from the answer to this question YAML Syntax Highlighting.
If I wanted to have "- name:" colored blue and not black, and "test" colored in blue, how is this possible?
spec:
containers:
- name: test
Starting from the answer to this question YAML Syntax Highlighting.
If I wanted to have "- name:" colored blue and not black, and "test" colored in blue, how is this possible?
spec:
containers:
- name: test
I needed to achieve a similar result, for a docker-compose YAML, and it was not immediate to find an answer. Anyway, this is a method that could allow you to achieve a result similar to the desired one:
\usepackage{listingsutf8}
\usepackage[usenames]{color}
\usepackage{xcolor}
\lstdefinelanguage{my-yaml}{
keywords={spec, containers, name}, % ,... all the keyword you want
keywordstyle=\color{blue}\bfseries,
moredelim=[is][commentstyle]{||}{££}, % invisible custom delimiters
identifierstyle=\color{black},
sensitive=false,
comment=[l]{#},
commentstyle=\color{olive}\ttfamily,
stringstyle=\color{orange}\ttfamily,
morestring=[b]',
morestring=[b]"
}
\begin{lstlisting}[language=my-yaml,caption={Docker Compose YAML composing the various containers of the setup together.},numbers=left]
spec:
containers:
- name: ||test££
\end{lstlisting}