Skip to main content
v2026.11,858 entries · CC-BY 4.0

Colors in Stata: Named Colors, RGB, Hex, and Schemes

Set Stata graph colors with named colors, RGB, hex, opacity and schemes, including the Stata 18 stcolor default versus s2color.

Written and maintained by CASRAI Editorial Board

Last updated

Stata colors are controlled in two layers: a scheme sets the overall look of a graph, and color options such as mcolor() and lcolor() override the color of individual items. Every color option accepts a colorstyle: a named color, an RGB, CMYK, HSV or hexadecimal value, optionally followed by an intensity or an opacity. Since Stata 18 the default scheme is stcolor, so older tutorials that show different default colors were usually drawn with s2color.

What it is used for in research

Color choices decide whether a figure survives its journey from screen to print. Stata’s manual describes colorstyle as the setting that “sets the color and opacity of graph components such as lines, backgrounds, and bars.” In practice, researchers use it to keep group colors consistent across the figures in one paper, to make overlapping points readable with opacity, and to match a journal’s color requirements. The same options apply to the charts covered in our guides to histograms in Stata, box plots in Stata and scatterplots in Stata.

Install or access (official source only)

Colors are built into Stata; there is nothing to install. Two official commands help you explore them:

  • graph query colorstyle lists the named colors.
  • palette color previews a color (see the [G-2] palette entry in the Stata manuals).
  • graph query, schemes lists the schemes installed on your copy.

Step-by-step task

1. Know what your default scheme is

The Stata schemes documentation states: “If you have not used the set scheme command to change your default scheme, your default scheme is stcolor.” The Stata 18 graph-style page describes stcolor as the new default, with a brighter color palette and black reference lines. Histogram fills use stc1 at 90% intensity with the outline at 70%.

2. Set a color on one graph item

  1. Pick the option for the item: mcolor() for markers, lcolor() for lines, bcolor() for bars, or the general color() that applies to all affected objects.
  2. Give it a colorstyle, for example a named color such as navy, maroon or teal.
  3. Run the command. The manual notes that, whatever scheme you choose, options such as mcolor() and lcolor() control the color of each item.

3. Choose the right format

You want Syntax Example from the manual
A named color the color name black, white, blue, red, green, yellow, orange, navy, maroon, teal
A gray gs0 (black) to gs16 (white) gs0, gs16
A scheme color stc1 to stc15, stblue, stgreen, stred, styellow stc1
RGB "# # #" white is “255 255 255”; navy is “26 71 111”
Hexadecimal "#RRGGBB" red is “#FF0000”
HSV "hsv # # #" white is “hsv 0 0 1”
CMYK (only when a journal or publisher supplies it) "# # # #" yellow is “0 0 255 0”
Invisible none none
Darker or lighter colorstyle*# (no space) green*.8 is lighter; purple*1.5 is darker
Transparency colorstyle%#, 0 to 100 green%50; “0 255 0%50”

Per the manual, an intensity of 1 leaves the color unchanged, a value greater than 1 makes the color darker, and a value less than 1 makes it lighter. For opacity, 100% fully hides the background and 0% is fully transparent, so color%0 equals none.

4. Fix overplotting with opacity

With graph twoway scatter, mcolor(%30) draws the default marker fill at 30% opacity, so overlapping points show through each other. Likewise, with graph twoway bar, bcolor(*.7) draws the default fill at reduced brightness.

5. Change the scheme

  1. For one graph, add scheme(schemename) to the command.
  2. For the session, run set scheme schemename.
  3. To make it persist across sessions, add , permanently, for example set scheme economist, permanently.
  4. To return to the factory default, run set scheme default, permanently.
  5. To get the pre-Stata 18 look, run set scheme s2color, permanently, or add scheme(s2color) to a single command.

Output and how to read it

The result is the graph window, plus any file you export. Colors you see come from the scheme unless an option overrides them. A saved graph reopens in the scheme it was drawn with; graph use mygraph, scheme(economist) redisplays it in another scheme.

For print, the schemes documentation says white-background schemes are suitable for printing. Background areas can be changed with graphregion(fcolor()), graphregion(ifcolor()), plotregion(fcolor()) and plotregion(ifcolor()). Black-background schemes such as s1rcolor print in monochrome by default. If a journal supplies CMYK values, use the four-value form; when all four values are 1 or less they are treated as proportions of ink (red is “0 1 1 0”).

Troubleshooting

RGB, CMYK, HSV or hex values behave strangely

Enclose them in quotes. The manual’s advice is to type “128 128 128”, not 128 128 128.

Intensity has no effect

Write it with no space: green*.8, not green *.8.

Your graph does not match a tutorial

The tutorial was probably drawn with s2color, the factory setting before Stata 18. Switch with scheme(s2color) to reproduce it.

A monochrome scheme still needs colors

Monochrome schemes do not stop you specifying colors; options like mcolor() still apply.

Free alternatives

Stata ships with several schemes that change colors without any color options. These are the ones listed in the official schemes documentation:

Scheme What the manual says
stcolor Factory setting; color, white background
stmono1, stmono2 Monochrome
stsj Official scheme for the Stata Journal
s2color Factory setting prior to Stata 18
s2mono Monochrome
s1rcolor Black background
economist Economist style, with colors such as ebg, ebblue and edkblue

Frequently asked questions

How do I change colors in Stata?

Add a color option with a colorstyle to the graph command, for example mcolor(navy), or change the scheme with set scheme.

What is the default color scheme in Stata?

stcolor, from Stata 18 onward. Before Stata 18 it was s2color.

How do I use a hex or RGB color in Stata?

Quote it: "#FF0000" for hex, "255 0 0" for RGB red.

How do I make Stata graph colors transparent?

Add %# from 0 to 100 to the colorstyle, for example green%50, or mcolor(%30) to change only the opacity of the default fill.

How do I list all Stata colors?

Run graph query colorstyle. Preview colors with palette color.

Sources (official docs)

Related reading: labeling variables and values in Stata.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Colors in Stata: Named Colors, RGB, Hex, and Schemes

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →