# Bold and Colored Image Caption

How can I color and bold an image's caption in \documentclass[12pt]{report}?

In this documentclass, as, I believe, in any documentclass, it is possible to use the caption package and the \textcolor command.

For example, if I want to color blue and bold the caption of a simple triangle drawn in TikZ in your documentclass, I can use the following code to achieve the following output, which I will break down below.

\documentclass[12pt]{report}

\usepackage{tikz}
\usepackage[labelfont={color=blue,bf}]{caption}

\begin{document}

\begin{figure}[h!]
\centering
\begin{tikzpicture}
\draw[black, very thick] (0,0) -- (3,2) -- (4,0) -- cycle;
\end{tikzpicture}
\caption{\textbf{\textcolor{blue}{A triangle.}}}
\label{fig:triangle}
\end{figure}

\end{document}


I began by declaring your documentclass of choice. Next, I called in tikz for the triangle and caption to change the color of "Figure 1:". I modified caption with two constraints under one modifier (labelfont), namely declaring the color to be blue (although it could be many others) and "bf" for boldface.

Then, down in the actual figure, I used \textbf{\textcolor{<color>}{<caption>}}. This combines the two separate commands to color the caption, itself.

Hope this helps!

• The problem, is that any cross-reference to this figure will also be in blue and boldface… – Bernard Jul 7 at 21:39
• @Bernard, not really, only cross reference will be only bold and not colored. – Zarko Jul 7 at 21:46
• @Zarko: really? In any case, it is preferable to do that through the caption package. – Bernard Jul 7 at 22:07

\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{caption}
\captionsetup{font={color=blue,bf}} % <---

\begin{document}

\begin{figure}[htb]
\centering
\includegraphics[width=0.8\linewidth]{example-image-duck}
\caption{A triangle.}
\label{fig:myfig}
\end{figure}
See figure~\ref{fig:myfig}   % <---

\end{document}