## LaTeX forum ⇒ Text Formatting ⇒ Itemize: bullet and text with the same color

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Molibdeno
Posts: 3
Joined: Fri Apr 07, 2017 12:15 pm

### Itemize: bullet and text with the same color

I'm trying to create a command to assign to an item and its text the same color

\newcommand{\onecolor}[1] { \item[\color{#1}] \textcolor{#1}}

Where #1 is the chosen color
The result is text is colored, but the bullet is not displayed:

Can you help me?

Complete code:

\documentclass{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage[italian]{babel}\usepackage[  a4paper,  margin=15mm,  bindingoffset=2mm,  heightrounded,]{geometry} \usepackage{amsmath}\usepackage{microtype}\usepackage{xcolor}\usepackage{varwidth}\usepackage{enumitem}\usepackage{hyperref}\usepackage{enumitem} \newcommand{\onecolor}[1] { \item[\color{#1}] \textcolor{#1}} \definecolor{lightgray}{HTML}{EFEFEF} \begin{document}  \begingroup\setlength{\fboxsep}{6pt}\colorbox{white}{%  \begin{varwidth}[t]{\textwidth}  TRIGONOMETRIA  \begin{itemize}    \onecolor{pink}{$\cot 2\alpha = \cfrac{2 \cot^{2} \alpha - 1}{2 \cot \alpha}$}	   \end{itemize}  \end{varwidth}%}\endgroup \end{document}

Tags:

Stefan Kottwitz
Posts: 8529
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Welcome to the forum!

You provided a very good code example. So it's very easy to test.
This is a way to change the bullet color, while other bullets stay the same:

\newcommand{\onecolor}[1]{\item[\textcolor{#1}{\labelitemi}]\textcolor{#1}}

Stefan