Q:

How to color just the `\vec` symbol?

How do I color only the vector symbol in \vec f? I'm using beamer, so xcolor is already loaded.
Extra "points" to an answer that also explains  how to fish..and not only gives me the fish.
Thanks!

A:

How about
$\color{red}{\vec{\color{black}{f}}}$

and if you want it a bit more automated
\newcommand{\colorvec}[1]{{\color{red}\vec{\color{black}{#1}}}}

which is to be used as $\colorvec{g}$

A:

You can use \textcolor that works also in math mode:
\documentclass{article}
\usepackage{xcolor}
\newcommand{\rvec}[2][black]{%
  \textcolor{red}{\vec{\textcolor{#1}{#2}}}
}
\begin{document}
$\vec{x}$

$\rvec{x}$

$\rvec[green]{x}$
\end{document}

In this way you're sure that the color change will be limited to this object. I've added an optional argument to change also the color of the variable.

