# Change color labelsep figure

I am trying to colour the figure caption of my report and also change the label separator from

Figure 1: This is a figure.

to

Figure 1 - This is a figure.

So far I had success changing the colour of the caption, however, when changing the

-

remains black. How can I achieve that everything is the same colour?

My MWE is the following:

\documentclass[12pt,twoside,titlepage]{article}

\usepackage{float}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\usepackage[labelfont={color=gray!50,md},textfont={color=gray!50,md},labelsep=endash]{caption}

\begin{document}

\begin{figure}[H]
\centering
\includegraphics[width=\textwidth]{fig1.jpg}
\caption{This is a Figure.}
\label{fig:fig1}
\end{figure}

\end{document}


You could use the \DeclareCaptionLabelSeparator command in order to define your own colored variant of endash and use the \captionsetup command in order to use this separator:

\documentclass[12pt,twoside,titlepage]{article}

\usepackage[table]{xcolor}
\usepackage{graphicx}
\usepackage{caption}

\DeclareCaptionLabelSeparator{myendash}{ \textcolor{gray!50}{\space\textendash\space}}
\captionsetup{labelfont={color=gray!50,md},textfont={color=gray!50,md},labelsep=myendash}

\begin{document}

\begin{figure}
\caption{This is a Figure.}
\label{fig:fig1}
\end{figure}

\end{document}

• Just \DeclareCaptionLabelSeparator{myendash}{\space\textendash\space} should be sufficient. (The original definition of endash uses the starred variant \DeclareCaptionLabelSeparator* to define the label separator, therefore it does not use the label font.) – user2574 Jul 10 '18 at 17:27