Color is a powerful tool in document design that can enhance readability, establish visual hierarchy, and create professional, memorable resumes and presentations. LaTeX's xcolor package provides comprehensive color support with multiple color models, predefined colors, and flexible syntax for creating custom color schemes.
This guide covers everything from basic colored text to advanced techniques like gradient boxes, colored tables, and professional resume color schemes that help your documents stand out while maintaining readability and ATS compatibility.
Table of Contents
xcolor Package Basics
The xcolor package is the standard LaTeX package for color management, extending the basic color package with additional features and color models.
Loading xcolor
% Basic usage
\usepackage{xcolor}
% With options
\usepackage[dvipsnames]{xcolor} % Access to 68 predefined colors
\usepackage[svgnames]{xcolor} % Access to 151 SVG colors
\usepackage[x11names]{xcolor} % Access to 317 X11 colors
\usepackage[table]{xcolor} % Enable table coloring commands
Common package options:
dvipsnames– Adds 68 named colors (NavyBlue, ForestGreen, etc.)svgnames– Adds 151 SVG color names (DarkSlateGray, Crimson, etc.)x11names– Adds 317 X11 color names (comprehensive set)table– Enables\rowcolor,\columncolorcommandshyperref– Better compatibility with hyperref package
Basic Color Commands
% Colored text
\textcolor{red}{This text is red}
% Colored box with text
\colorbox{yellow}{Text with yellow background}
% Framed colored box
\fcolorbox{red}{yellow}{Red frame, yellow background}
Predefined Colors
xcolor provides numerous predefined colors. Without options, you get 19 basic colors. With dvipsnames, svgnames, or x11names, you access hundreds more.
Basic Colors (Always Available)
19 standard colors:
- black, white, red, green, blue, cyan, magenta, yellow
- darkgray, gray, lightgray
- brown, lime, olive, orange, pink, purple, teal, violet
\textcolor{red}{Red text}
\textcolor{blue}{Blue text}
\textcolor{green}{Green text}
dvipsnames Colors (68 colors)
\usepackage[dvipsnames]{xcolor}
\textcolor{NavyBlue}{Navy Blue text}
\textcolor{ForestGreen}{Forest Green text}
\textcolor{BrickRed}{Brick Red text}
\textcolor{RoyalPurple}{Royal Purple text}
Popular dvipsnames colors for resumes:
- Blues: NavyBlue, RoyalBlue, MidnightBlue, CornflowerBlue
- Grays: Gray, DarkGray, LightGray
- Greens: ForestGreen, OliveGreen, SeaGreen
- Reds: BrickRed, Maroon, Mahogany
svgnames Colors (151 colors)
\usepackage[svgnames]{xcolor}
\textcolor{DarkSlateGray}{Dark Slate Gray}
\textcolor{SteelBlue}{Steel Blue}
\textcolor{Crimson}{Crimson text}
Colored Text
The primary command for colored text is \textcolor, but xcolor provides several alternatives for different use cases.
Basic Colored Text
\textcolor{blue}{This entire phrase is blue}
This is normal text, but \textcolor{red}{this part is red}, continuing normally.
Color Command (Switch Style)
{\color{blue} All text here is blue until the group ends.}
Normal text again.
The \color command changes text color for everything that follows within the current group (delimited by {} or environment).
Colored Sections in Resumes
% Colored section headings
\section{\textcolor{NavyBlue}{Experience}}
\section{\textcolor{NavyBlue}{Education}}
% Or define a custom command
\newcommand{\cvsection}[1]{%
\section{\textcolor{NavyBlue}{#1}}
}
\cvsection{Technical Skills}
\cvsection{Projects}
Color Models: RGB, HTML, CMYK
Beyond named colors, xcolor supports multiple color models for precise color specification.
RGB Color Model
RGB defines colors using Red, Green, Blue values from 0 to 1:
% RGB syntax: {r,g,b} where each is 0-1
\textcolor[RGB]{255,0,0}{Red (255,0,0)}
\textcolor[RGB]{0,128,0}{Green (0,128,0)}
\textcolor[RGB]{0,0,255}{Blue (0,0,255)}
% Lowercase rgb uses 0-1 scale
\textcolor[rgb]{1,0,0}{Red (1,0,0)}
\textcolor[rgb]{0,0.5,0}{Green (0,0.5,0)}
RGB vs rgb:
RGB– Values from 0 to 255 (standard web format)rgb– Values from 0 to 1 (normalized format)
HTML/Hex Colors
Use familiar hex color codes from web design:
\textcolor[HTML]{FF0000}{Red}
\textcolor[HTML]{0080FF}{Sky Blue}
\textcolor[HTML]{2E8B57}{Sea Green}
\textcolor[HTML]{333333}{Dark Gray}
Popular hex colors for professional resumes:
#2C3E50– Professional dark blue-gray#34495E– Muted slate blue#16A085– Modern teal#2980B9– Bright professional blue#8E44AD– Creative purple#C0392B– Bold red
CMYK Color Model
For print documents, use CMYK (Cyan, Magenta, Yellow, Black):
% CMYK syntax: {c,m,y,k} where each is 0-1
\textcolor[cmyk]{1,0,0,0}{Cyan}
\textcolor[cmyk]{0,1,0,0}{Magenta}
\textcolor[cmyk]{0,0,1,0}{Yellow}
\textcolor[cmyk]{0,0,0,1}{Black}
Grayscale
% Gray scale: 0 (black) to 1 (white)
\textcolor[gray]{0}{Black}
\textcolor[gray]{0.5}{Medium gray}
\textcolor[gray]{0.75}{Light gray}
Defining Custom Colors
Create reusable custom colors with \definecolor and \colorlet commands.
Define Custom Colors
% Define in preamble
\definecolor{myblue}{RGB}{41,128,185}
\definecolor{myred}{HTML}{E74C3C}
\definecolor{mygray}{gray}{0.4}
% Use in document
\textcolor{myblue}{Text in custom blue}
\colorbox{myred}{Background in custom red}
Professional Resume Color Palette
% Modern professional palette
\definecolor{primary}{HTML}{2C3E50} % Dark blue-gray (headings)
\definecolor{secondary}{HTML}{3498DB} % Bright blue (accents)
\definecolor{accent}{HTML}{E74C3C} % Red (highlights)
\definecolor{textgray}{HTML}{7F8C8D} % Medium gray (secondary text)
\definecolor{lightgray}{HTML}{ECF0F1} % Light gray (backgrounds)
% Usage
\section{\textcolor{primary}{Experience}}
\textcolor{secondary}{Senior Software Engineer}
\textcolor{textgray}{2020 -- Present}
Color Mixing
% Mix two colors
\textcolor{red!50!blue}{Purple (50% red, 50% blue)}
\textcolor{blue!30!white}{Light blue (30% blue, 70% white)}
\textcolor{black!80}{80% black (20% white)}
% Complex mixing
\textcolor{red!50!green!20!blue}{Custom mixed color}
Color Let (Create Aliases)
% Create color aliases
\colorlet{primarycolor}{NavyBlue}
\colorlet{accentcolor}{BrickRed}
% Easy to change entire color scheme
\textcolor{primarycolor}{Consistent color usage}
Colored Boxes & Backgrounds
Create colored backgrounds, frames, and boxes for highlighting important content.
Basic Color Boxes
% Simple colored background
\colorbox{yellow}{Highlighted text}
% Colored frame with background
\fcolorbox{red}{yellow}{Red border, yellow background}
% Control padding
\setlength{\fboxsep}{10pt}
\colorbox{lightgray}{More padding around text}
Full-Width Colored Sections
% Colored section background
\noindent\colorbox{lightgray}{%
\parbox{\dimexpr\textwidth-2\fboxsep}{%
\textbf{Key Skills} \\[5pt]
Python, JavaScript, React, Node.js, PostgreSQL
}
}
Colored Resume Section Headers
\usepackage{xcolor}
\definecolor{sectionbg}{HTML}{3498DB}
\newcommand{\cvsection}[1]{%
\vspace{10pt}
\noindent\colorbox{sectionbg}{%
\parbox{\dimexpr\textwidth-2\fboxsep}{%
\textcolor{white}{\Large\bfseries #1}
}
}
\vspace{5pt}
}
\cvsection{Professional Experience}
Sidebar Colored Backgrounds
\usepackage[many]{tcolorbox}
\begin{tcolorbox}[colback=blue!5, colframe=blue!75!black, title=Skills]
\begin{itemize}
\item Python programming
\item Machine learning
\item Data visualization
\end{itemize}
\end{tcolorbox}
Fancy Boxes with tcolorbox
\usepackage[most]{tcolorbox}
% Custom box style
\newtcolorbox{highlightbox}{
colback=yellow!10,
colframe=orange!75,
fonttitle=\bfseries,
rounded corners
}
\begin{highlightbox}[title=Important Note]
This content stands out with colored styling.
\end{highlightbox}
Coloring Tables
Add colors to table rows, columns, and cells for better readability and visual appeal.
Enable Table Coloring
\usepackage[table]{xcolor}
Row Colors
\begin{tabular}{ll}
\rowcolor{lightgray}
\textbf{Name} & \textbf{Role} \\
\hline
John Doe & Engineer \\
\rowcolor{lightgray}
Jane Smith & Designer \\
Bob Wilson & Manager \\
\end{tabular}
Alternating Row Colors
\rowcolors{1}{white}{lightgray}
\begin{tabular}{lll}
\textbf{Product} & \textbf{Price} & \textbf{Stock} \\
\hline
Widget A & \$10 & 50 \\
Widget B & \$15 & 30 \\
Widget C & \$20 & 45 \\
Widget D & \$25 & 60 \\
\end{tabular}
Column Colors
\begin{tabular}{>{\columncolor{lightgray}}l ll}
\textbf{Name} & \textbf{Age} & \textbf{City} \\
\hline
John & 25 & NYC \\
Jane & 30 & LA \\
\end{tabular}
Cell Colors
\begin{tabular}{lll}
\textbf{Q1} & \textbf{Q2} & \textbf{Q3} \\
\hline
\cellcolor{green!25}Good & \cellcolor{yellow!25}OK & \cellcolor{red!25}Bad \\
\end{tabular}
Professional Resume Skills Table
\definecolor{headerbg}{HTML}{34495E}
\definecolor{rowcolor1}{HTML}{ECF0F1}
\begin{tabular}{>{\columncolor{headerbg}\color{white}}l l}
\textbf{Category} & \textbf{Skills} \\
\hline
\rowcolor{rowcolor1}
Languages & Python, JavaScript, Java, C++ \\
\rowcolor{white}
Frameworks & React, Django, Spring Boot \\
\rowcolor{rowcolor1}
Databases & PostgreSQL, MongoDB, Redis \\
\end{tabular}
Colors for Resumes & CVs
Strategic use of color in resumes can enhance readability, establish visual hierarchy, and make your document memorable—while maintaining ATS compatibility.
Resume Color Best Practices
- Keep it professional: Use 1-2 accent colors maximum
- Ensure readability: Maintain high contrast (dark text on light backgrounds)
- ATS-friendly: Use colors for visual elements, but ensure text remains readable when printed in grayscale
- Industry-appropriate: Conservative colors (navy, gray) for finance/law; brighter colors acceptable for creative fields
- Consistent usage: Apply colors systematically (all section headers same color)
Conservative Professional Palette
% Traditional corporate/finance/legal
\definecolor{primary}{HTML}{1C2833} % Almost black
\definecolor{accent}{HTML}{2E4053} % Dark slate gray
\definecolor{secondary}{HTML}{566573} % Medium gray
% Usage: subtle color on section headers and lines
\section{\textcolor{accent}{Professional Experience}}
Modern Professional Palette
% Tech/startup/modern industries
\definecolor{primary}{HTML}{2C3E50} % Dark blue-gray
\definecolor{accent}{HTML}{3498DB} % Bright blue
\definecolor{highlight}{HTML}{E74C3C} % Red for emphasis
% More visible color usage
\section{\textcolor{primary}{Technical Skills}}
\textcolor{accent}{\textbf{Senior Developer}} | Company Name
Creative Industry Palette
% Design/marketing/creative fields
\definecolor{primary}{HTML}{8E44AD} % Purple
\definecolor{accent}{HTML}{16A085} % Teal
\definecolor{highlight}{HTML}{F39C12} % Orange
% Bolder color usage acceptable
\section{\colorbox{primary}{\textcolor{white}{Portfolio}}}
Complete Resume Example with Color
\documentclass{article}
\usepackage[margin=0.75in]{geometry}
\usepackage{xcolor}
\usepackage{hyperref}
% Define color palette
\definecolor{primary}{HTML}{2C3E50}
\definecolor{accent}{HTML}{3498DB}
\definecolor{textgray}{HTML}{7F8C8D}
% Custom section command
\newcommand{\cvsection}[1]{%
\vspace{10pt}
{\Large\bfseries\textcolor{primary}{#1}}
\textcolor{accent}{\hrule height 1pt}
\vspace{5pt}
}
% Custom job entry
\newcommand{\job}[4]{%
\textcolor{accent}{\textbf{#1}} \hfill \textcolor{textgray}{\textit{#2}} \\
\textit{#3} \hfill \textcolor{textgray}{#4}
}
\begin{document}
{\Huge\bfseries\textcolor{primary}{John Doe}}
\textcolor{textgray}{
john.doe@email.com | (555) 123-4567 | linkedin.com/in/johndoe
}
\cvsection{Professional Experience}
\job{Senior Software Engineer}{Jan 2022 -- Present}{Tech Company Inc.}{San Francisco, CA}
\begin{itemize}
\item Developed microservices architecture
\item Reduced API latency by 40\%
\end{itemize}
\cvsection{Technical Skills}
\textcolor{accent}{\textbf{Languages:}} Python, JavaScript, Java, C++
\end{document}
Colored Links (ATS-Safe)
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
urlcolor=blue,
citecolor=blue
}
% In resume
Email: \href{mailto:john@example.com}{john@example.com}
Portfolio: \href{https://johndoe.com}{johndoe.com}
Advanced Techniques
Color Series for Data Visualization
% Define color series
\definecolorseries{mycolors}{rgb}{last}{blue}{red}
\resetcolorseries{mycolors}
% Use in sequence
\textcolor{mycolors!!+}{First item}
\textcolor{mycolors!!+}{Second item}
\textcolor{mycolors!!+}{Third item}
Transparent Colors
% Mix with white for transparency effect
\textcolor{blue!30}{30% blue (70% transparent)}
\colorbox{red!20}{Light red background}
Gradient-Like Effects
% Simulate gradient with tcolorbox
\usepackage{tcolorbox}
\begin{tcolorbox}[
enhanced,
colback=blue!5,
colframe=blue!75!black,
borderline={1pt}{0pt}{blue!75!black},
borderline={1pt}{1pt}{blue!50!black},
borderline={1pt}{2pt}{blue!25!black}
]
Content with gradient-like border
\end{tcolorbox}
Conditional Colors
\newcommand{\grade}[1]{%
\ifnum#1>89
\textcolor{green}{\textbf{#1}}%
\else\ifnum#1>79
\textcolor{yellow}{\textbf{#1}}%
\else
\textcolor{red}{\textbf{#1}}%
\fi\fi
}
Grade: \grade{95} % Green
Grade: \grade{85} % Yellow
Grade: \grade{75} % Red
Page Background Color
\usepackage{pagecolor}
\pagecolor{lightgray}
% Or specific pages
\newpage
\pagecolor{yellow}
Content on yellow page
\newpage
\pagecolor{white}
Troubleshooting
Undefined Color Name Error
Problem: ! Package xcolor Error: Undefined color 'NavyBlue'
Solution: Load xcolor with appropriate options:
\usepackage[dvipsnames]{xcolor} % For NavyBlue, ForestGreen, etc.
Color Bleeding Beyond Box
Problem: Colored box extends too far or overlaps text.
Solution: Adjust \fboxsep and use \parbox with correct width:
\noindent\colorbox{lightgray}{%
\parbox{\dimexpr\textwidth-2\fboxsep}{%
Content here
}
}
Colors Look Different in PDF
Problem: Colors appear differently than expected in final PDF.
Solution: Use consistent color model throughout document and verify with PDF viewer:
% Stick to one color model
\definecolor{myblue}{HTML}{3498DB} % Not RGB in some places, HTML in others
Table Row Colors Not Working
Problem: \rowcolor command not recognized.
Solution: Load xcolor with table option:
\usepackage[table]{xcolor}
Colors Don't Print
Problem: Colors visible on screen but don't print.
Solution: Check printer settings and PDF viewer (may be set to grayscale). For professional printing, use CMYK color model:
\definecolor{printblue}{cmyk}{1,0.5,0,0}
Hyperref Color Conflicts
Problem: Hyperref and xcolor produce compilation errors or unexpected colors.
Solution: Load xcolor before hyperref or use xcolor's hyperref option:
% Method 1: Load order
\usepackage[dvipsnames]{xcolor}
\usepackage{hyperref}
% Method 2: Use option
\usepackage[dvipsnames,hyperref]{xcolor}
Frequently Asked Questions
How do I add colors to LaTeX documents?
Load the xcolor package and use \textcolor command:
\usepackage{xcolor}
\textcolor{red}{This text is red}
\textcolor{blue}{This text is blue}
For more colors, load with options: \usepackage[dvipsnames]{xcolor} for 68 additional named colors.
How do I use RGB colors in LaTeX?
Use the RGB color model with values 0-255:
\textcolor[RGB]{255,0,0}{Red}
\textcolor[RGB]{0,128,255}{Sky Blue}
\textcolor[RGB]{128,0,128}{Purple}
Alternatively, use lowercase rgb with values 0-1: \textcolor[rgb]{1,0,0}{Red}
How do I use hex color codes in LaTeX?
Use the HTML color model with 6-digit hex codes (without the #):
\textcolor[HTML]{FF0000}{Red}
\textcolor[HTML]{3498DB}{Blue}
\textcolor[HTML]{2ECC71}{Green}
\textcolor[HTML]{333333}{Dark Gray}
This is identical to web/CSS hex colors, just omit the # symbol.
How do I create custom colors in LaTeX?
Use \definecolor command in your preamble:
\definecolor{myblue}{RGB}{41,128,185}
\definecolor{myred}{HTML}{E74C3C}
\definecolor{mygray}{gray}{0.5}
% Use in document
\textcolor{myblue}{Custom blue text}
This creates reusable color names you can use throughout your document for consistency.
How do I add colored backgrounds to text?
Use \colorbox for simple backgrounds or \fcolorbox for backgrounds with borders:
% Simple background
\colorbox{yellow}{Highlighted text}
% Background with colored border
\fcolorbox{red}{yellow}{Red border, yellow background}
% Full-width background
\noindent\colorbox{lightgray}{%
\parbox{\dimexpr\textwidth-2\fboxsep}{%
Full-width colored section
}
}
How do I color table rows in LaTeX?
Load xcolor with the table option and use \rowcolor:
\usepackage[table]{xcolor}
\begin{tabular}{ll}
\rowcolor{lightgray}
\textbf{Name} & \textbf{Age} \\
\hline
John & 25 \\
\rowcolor{lightgray}
Jane & 30 \\
\end{tabular}
% Alternating colors
\rowcolors{1}{white}{lightgray}
What colors are best for professional resumes?
Conservative industries (finance, law): Dark blue, navy, dark gray, charcoal
\definecolor{primary}{HTML}{2C3E50} % Dark blue-gray
\definecolor{accent}{HTML}{34495E} % Slate gray
Tech/modern industries: Bright blue, teal, modern gray
\definecolor{primary}{HTML}{3498DB} % Bright blue
\definecolor{accent}{HTML}{16A085} % Teal
Creative industries: Purple, orange, vibrant colors acceptable
Always maintain high contrast and ensure text is readable in grayscale for ATS systems.
How do I mix colors in LaTeX?
Use the ! operator to mix colors by percentage:
% 50% red + 50% blue = purple
\textcolor{red!50!blue}{Purple}
% 70% blue + 30% white = light blue
\textcolor{blue!70!white}{Light blue}
% 80% black = dark gray
\textcolor{black!80}{Dark gray}
% Complex mixing
\textcolor{red!50!green!20!blue}{Multi-color mix}
The percentage before ! indicates how much of that color to use.
Are colored resumes ATS-friendly?
Yes, if used properly. ATS systems primarily care about text content, not colors. Best practices:
- Use colors for visual elements (section headers, lines, accents)
- Keep body text in dark colors with high contrast
- Ensure document is readable when converted to grayscale
- Avoid light text on light backgrounds
- Test by printing in black and white—if readable, it's ATS-safe
Colors enhance visual appeal for human reviewers without affecting ATS parsing.
How do I change the color of section headings?
Use \textcolor in section commands or redefine section formatting:
% Manual method
\section{\textcolor{blue}{Experience}}
\section{\textcolor{blue}{Education}}
% Define custom command
\newcommand{\coloredsection}[1]{%
\section{\textcolor{blue}{#1}}
}
\coloredsection{Technical Skills}
% Using titlesec package (automatic)
\usepackage{titlesec}
\titleformat{\section}
{\Large\bfseries\color{blue}}
{\thesection}{1em}{}
Conclusion
The xcolor package provides comprehensive color support for LaTeX documents, from simple text coloring to complex colored tables and backgrounds. Whether you're creating a modern resume with strategic color accents, a colorful presentation, or a technical document with color-coded elements, xcolor offers the flexibility and precision needed for professional results.
For resumes, thoughtful use of 1-2 accent colors can significantly enhance visual appeal and readability while maintaining ATS compatibility. Choose colors appropriate for your industry, ensure high contrast for readability, and test your document in grayscale to verify it remains effective when printed.
With support for multiple color models (RGB, HTML, CMYK, grayscale), color mixing, and integration with table and box environments, xcolor is an essential tool for modern LaTeX document design.