colored text in latex

colored text in latex

StartLaTeX faqLaTeX topicsLaTeX course

< colored frames   > set margins in latex  

colored text in latex

How to write colored text in latex? To get color into LaTeX use the usepackage xcolor. By using the command \textcolor{color}{text} Per default the following colors are available:
red, green, blue, cyan, magenta, yellow, black, white , darkgray, gray, lightgray

example colored text in latex

\textcolor{red}{red}, \textcolor{green}{green}, \textcolor{blue}{blue}, 
\textcolor{cyan}{cyan}, \textcolor{magenta}{magenta}, 
\textcolor{yellow}{yellow}, \textcolor{black}{black}, 
\textcolor{darkgray}{darkgray}, \textcolor{gray}{gray}, 
By using xcolor you also could get some colored frames.

colored text in latex beamer

How to change the text color in latex beamer? Or how to get colored text in latex beamer? In the following example first of all the background color of the frames would be changed to see the white text color.
Background color will be changed by the command \setbeamercolor{background canvas}{bg=black!50}
change the color of the writing by \setbeamercolor{normal text}{fg=white} and an addtional command \usebeamercolor*{normal text}. Without the last command text color would not change.
Now got a grey background and white text on it:
example code

\setbeamercolor{background canvas}{bg=black!50}
\setbeamercolor{normal text}{fg=white}\usebeamercolor*{normal text}


% set it back to default values
\setbeamercolor{background canvas}{bg=white,fg=black}
\setbeamercolor{normal text}{fg=black}\usebeamercolor*{normal text}


Other colors could be used in the same way.