[Tex/LaTex] Change “FIGURE 1:” color, but not caption color

captionscolor

I would like to change the color of the "FIGURE 1:" portion of my caption to blue (including the number & colon), but I want the remainder of the caption to be black. I have tried the following in my preamble, however, the whole caption is blue:

\documentclass{article}
\usepackage{color}
\renewcommand{\figurename}{\color{blue}{FIGURE}}
\usepackage{graphicx}

\begin{document}

\begin{figure}
        \includegraphics[width=\linewidth]{../ubmFigures/exampledoc}
         \caption{An example figure}
\end{figure}
\end{document}

Best Answer

The caption package provides better control over caption elements. Specifically, you can set the labelfont and textfont to include colour or not. With the elements grouped, just setting labelfont{color=blue} prints the \figurename, number and separator in blue:

enter image description here

\documentclass{article}
\usepackage{graphicx,xcolor}% http://ctan.org/pkg/{grahpicx,xcolor}
\usepackage{caption}
\renewcommand{\figurename}{FIGURE}
\captionsetup[figure]{labelfont={color=blue}}
\begin{document}
\begin{figure}
  \includegraphics{example-image-a}
  \caption{An example figure}
\end{figure}
\end{document}

A discussion on the options are available from the caption documentation (section 2.3 Fonts, p 9-10).