2

Would it be possible through the \setlist of the enumitem package to globally color all labels with a unique color for itemize, enumerate and descriptions environments without going through the redefinition of each of them and keeping their default format otherwise?

2 Answers 2

2

This is possible and will trickle down to nested lists if you set the font key, since the default font attribute is empty except for description which has a default of \bfseries:

enter image description here

\documentclass{article}

\usepackage{enumitem,xcolor}

\setlist[itemize]{font=\color{itemizecolor}}
\colorlet{itemizecolor}{.}% Default colour for \item in itemize
\setlist[enumerate]{font=\color{enumeratecolor}}
\colorlet{enumeratecolor}{.}% Default colour for \item in enumerate
\setlist[description]{font=\bfseries\color{descriptioncolor}}
\colorlet{descriptioncolor}{.}% Default colour for \item[.] in description

\begin{document}

\colorlet{itemizecolor}{red}
\colorlet{enumeratecolor}{blue}
\colorlet{descriptioncolor}{green}

\begin{itemize}
  \item First item
  \item Second item
  \item Last item
\end{itemize}

\begin{enumerate}
  \item First item
  \item Second item
  \item Last item
\end{enumerate}

\begin{description}
  \item[First] item
  \item[Second] item
  \item[Last] item
\end{description}

\end{document}
1
\documentclass{article}
\usepackage{enumitem, xcolor}
\setlist[enumerate]{label=\color{red}\arabic*.}
\setlist[itemize]{label=\color{blue}\textbullet}

\begin{document}
\section*{enumerate}
\begin{enumerate}
    \item test
    \item test
\end{enumerate}

\section*{itemize}
\begin{itemize}
    \item test
    \item test
\end{itemize}

\end{document}

enter image description here

4
  • yes but you set all nested lists to textbullet labels, which I want to avoid. I want to keep the default format of all lists.
    – pluton
    May 26, 2020 at 12:11
  • If you just want to change it for the outer environment in a nested situation, just add a 1, like \setlist[enumerate, 1]{label=\color{red}\arabic*.} in the definitions. See my updated answer.
    – Nico
    May 26, 2020 at 12:15
  • Yes but I want to change the color for all list levels without affecting other list features...
    – pluton
    May 26, 2020 at 12:16
  • 1
    Ok, then you would need to redefine each level of each list seperately.
    – Nico
    May 26, 2020 at 12:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .