{smcl}
{* 28dec2018}{...}
{hi:help colorpalette9}{...}
{right:{browse "http://repec.sowi.unibe.ch/stata/palettes/"}}
{right:{browse "http://github.com/benjann/palettes/"}}
{hline}

{title:Title}

{pstd}{hi:colorpalette9} {hline 2} Color palettes (Stata 9)

{hline}
{pstd}
    This is a backward compatible version of the {helpb colorpalette} command that works in
    Stata 9.2 or newer. Users of Stata 14.2 or newer can use command {helpb colorpalette}.
    {p_end}
{hline}

{marker syntax}{...}
{title:Syntax}

{pstd}
    Syntax 1: Retrieve/display colors from one or multiple palettes

{p 8 15 2}
    {cmd:colorpalette9} [{it:argument}]
        [{cmd:,} {help colorpalette9##opts:{it:palette_options}}
        {help colorpalette9##gopts:{it:graph_options}} ]

{pstd}
    where {it:argument} is

{p 8 15 2}
    {help colorpalette9##palette:{it:palette}}
    [[, {help colorpalette9##opts:{it:palette_options}}] /
    [ {help colorpalette9##palette:{it:palette}}
    [, {help colorpalette9##opts:{it:palette_options}}] / ... ]]

{pstd}
    Syntax 2: Display an overview of multiple palettes

{p 8 15 2}
    {cmd:colorpalette9} [{cmd:,} {help colorpalette9##opts:{it:palette_options}}
        {help colorpalette9##gopts:{it:graph_options}} ] {cmd::} {it:pspec} [ {cmd:/} {it:pspec} {cmd:/} ... ]

{pstd}
    where {it:pspec} is

{p 8 15 2}
    {help colorpalette9##palette:{it:palette}} [{cmd:,} {help colorpalette9##opts:{it:palette_options}}]

{pstd}
or {cmd:.} to insert a gap.


{synoptset 20 tabbed}{...}
{marker palette}{synopthdr:palette}
{synoptline}
{syntab:Stata palettes ({stata "colorpalette9, lc(black): s2 / s1 / s1r / economist / mono":{it:view}})}
{synopt:{helpb colorpalette9##s2:s2}}15 colors as in Stata's {helpb scheme s2:s2color} scheme; the default{p_end}
{synopt:{helpb colorpalette9##s1:s1}}15 colors as in Stata's {helpb scheme s1:s1color} scheme{p_end}
{synopt:{helpb colorpalette9##s1r:s1r}}15 colors as in Stata's {helpb scheme s1:s1rcolor} scheme{p_end}
{synopt:{helpb colorpalette9##economist:economist}}15 colors as in Stata's {helpb scheme economist:economist} scheme{p_end}
{synopt:{helpb colorpalette9##mono:mono}}15 gray scales as in Stata's monochrome schemes{p_end}

{syntab:Other palettes ({stata "colorpalette9, lc(black): cblind / plottig / 538 / mrc / tfl / burd / lean":{it:view}})}
{synopt:{helpb colorpalette9##cblind:cblind}}9 colorblind-friendly by Okabe and Ito (2002){p_end}
{synopt:{helpb colorpalette9##plottig:plottig}}15 colors as in {cmd:plottig} by Bischof (2017b){p_end}
{synopt:{helpb colorpalette9##538:538}}6 + 7 colors as in {cmd:538} by Bischof (2017a){p_end}
{synopt:{helpb colorpalette9##mrc:mrc}}7 colors as in {cmd:mrc} by Morris (2013){p_end}
{synopt:{helpb colorpalette9##tfl:tfl}}8 colors as in {cmd:tfl} by Morris (2015){p_end}
{synopt:{helpb colorpalette9##burd:burd}}9 + 4 colors as in {cmd:burd} by Briatte (2013){p_end}
{synopt:{helpb colorpalette9##lean:lean}}15 gray scales as in {cmd:lean} by Juul (2003){p_end}

{syntab:Color generators}
{synopt:{helpb colorpalette9##hue:hue}}evenly spaced HCL hues{p_end}
{synopt:{helpb colorpalette9##hcl:hcl}}HCL color generator{p_end}
{synopt:{helpb colorpalette9##hsv:hsv}}HSV color generator{p_end}

{syntab:Collections}
{synopt:{it:{help colorpalette9##cbrew:colorbrewer}}}ColorBrewer palettes ({browse "http://colorbrewer2.org":colorbrewer2.org}){p_end}
{synopt:{helpb colorpalette9##ptol:ptol}}color schemes from Tol (2012){p_end}
{synopt:{helpb colorpalette9##d3:d3}}categorical color schemes from {browse "http://d3js.org/":D3.js}{p_end}
{synopt:{helpb colorpalette9##lin:lin}}semantic colors schemes by Lin et al. (2013){p_end}
{synopt:{helpb colorpalette9##spmap:spmap}}color schemes from {cmd:spmap} by Pisati (2007){p_end}
{synopt:{helpb colorpalette9##sfso:sfso}}color schemes used by the Swiss Federal
    Statistical Office{p_end}

{syntab:Custom}
{synopt:{it:{help colorpalette9##colorlist:colorlist}}}custom list of colors{p_end}
{synopt:{it:{help colorpalette9##myname:myname}}}custom palette provided by program {cmd:colorpalette9_}{it:myname}{p_end}
{synoptline}


{synoptset 20}{...}
{marker opts}{synopthdr:palette_options}
{synoptline}
{synopt:{helpb colorpalette9##n:n({it:#})}}specify size of palette (number of colors)
    {p_end}
{synopt:{helpb colorpalette9##select:{ul:s}elect({it:numlist})}}select/order elements
    {p_end}
{synopt:{helpb colorpalette9##reverse:{ul:r}everse}}arrange palette in reverse order
    {p_end}
{synopt:{helpb colorpalette9##intensity:{ul:in}tensity({it:numlist})}}apply color intensity adjustment
    {p_end}
{synopt:{helpb colorpalette9##opacity:{ul:op}acity({it:numlist})}}set opacity, in percent
    {p_end}
{synopt:{helpb colorpalette9##ipolate:{ul:ip}olate({it:#})}}linearly interpolate to # colors
    {p_end}
{synopt:{help colorpalette9##other:{it:other}}}palette-specific options
    {p_end}
{synoptline}


{synoptset 20 tabbed}{...}
{marker gopts}{synopthdr:graph_options}
{synoptline}
{syntab:Main}
{synopt:{helpb colorpalette9##title:{ul:ti}tle({it:string})}}custom graph title
    {p_end}
{synopt:{helpb colorpalette9##gropts:{ul:gr}opts({it:options})}}options to be
    passed through to the graph command
    {p_end}

{syntab:Syntax 1 only}
{synopt:{helpb colorpalette9##rows:rows({it:#})}}minimum number of rows; default is 5
    {p_end}
{synopt:{helpb colorpalette9##nograph:{ul:nogr}aph}}do not generate a graph
    {p_end}

{syntab:Syntax 2 only}
{synopt:{helpb colorpalette9##horizontal:{ul:hor}izontal}}horizontal plot; the default
    {p_end}
{synopt:{helpb colorpalette9##vertical:{ul:vert}ical}}vertical plot
    {p_end}
{synopt:{helpb colorpalette9##labels:{ul:lab}els({it:strlist})}}custom palette labels
    {p_end}
{synopt:{helpb colorpalette9##lcolor:{ul:lc}olor({it:colorstyle})}}custom outline color
    {p_end}
{synopt:{helpb colorpalette9##lwidth:{ul:lw}idth({it:lwstyle})}}custom outline thickness
    {p_end}
{synoptline}


{marker description}{...}
{title:Description}

{pstd}
    {cmd:colorpalette9} is a utility command to retrieve or display color
    palettes. Palette entries are returned in
    {helpb colorpalette9##returns:r()}.

{pstd}
    {cmd:colorpalette9} is used by {helpb grstyle set}.


{marker options}{...}
{title:Options}

{dlgtab:Palette options}

{marker n}{...}
{phang}
    {opt n(#)} specifies the size of the palette (the number of elements). In many
    cases this just selects the first {it:#} elements from the palette and is
    thus equivalent to {cmd:select(1/}{it:#}{cmd:)}. However, some color
    schemes ({cmd:hue}, {cmd:hcl}, {cmd:hsv}, {cmd: ptol}, sequential and
    diverging ColorBrewer palettes) return colors that adjust to the size of
    the palette.

{marker select}{...}
{phang}
    {opth select(numlist)} selects and orders the elements retrieved from
    the palette.

{marker reverse}{...}
{phang}
    {opt reverse} returns the palette in reverse order.

{marker intensity}{...}
{phang}
    {opth intensity(numlist)} applies color intensity adjustment. The values in
    {it:numlist} must be between 0 and 255. Values below 1 make the colors
    lighter; values larger than one make the colors darker. Specify multiple
    values to use different adjustments across the selected palette elements.
    The list of adjustments will be recycled if it is shorter than the list of
    selected palette elements. Likewise, palette elements will be recycled if
    the list of adjustments is longer than the palette.

{marker opacity}{...}
{phang}
    {opth opacity(numlist)} sets the opacity level(s) (0: fully transparent,
    100: fully opaque; Stata 15 required). Specify multiple values to use different
    opacity levels across the selected palette elements. The list of opacity
    levels will be recycled if it is shorter than the list of selected palette
    elements. Likewise, palette elements will be recycled if the list of
    opacity levels is longer than the palette.

{marker ipolate}{...}
{phang}
    {opt ipolate(#)} linearly interpolates the colors in the palette to {it:#}
    colors (after applying all other options). You can use this option
    to create color ramps. Interpolation is performed in the color space in which
    the palette is returned (usually RGB). Intensity adjustment and opacity are
    also interpolated. Examples:

        . {stata colorpalette9 cranberry dkorange, ipolate(5)}
        . {stata "colorpalette9: RdYlGn /  RdYlGn, ipolate(21)"}

{marker other}{...}
{phang}
    {it:other} are additional palette-specific options. See the descriptions of
    the palettes below.

{dlgtab:Graph options}

{marker title}{...}
{phang}
    {opt title(string)} specifies a custom title for the graph.

{marker gropts}{...}
{phang}
    {cmd:gropts(}{it:{help twoway_options}}{cmd:)} provides options to
    be passed through to the graph command.

{marker rows}{...}
{phang}
    {opt rows(#)} specifies the minimum number of rows in the graph (syntax 1
    only). The default is 5.

{marker nograph}{...}
{phang}
    {opt nograph} suppresses the graph (syntax 1 only).

{marker horizontal}{...}
{phang}
    {opt horizontal} displays the palettes horizontally (syntax 2 only). This
    is the default.

{marker vertical}{...}
{phang}
    {opt vertical} displays the palettes vertically (syntax 2 only).

{marker labels}{...}
{phang}
    {opt labels(strlist)} provides custom labels for the palettes (syntax 2
    only). Enclose labels with spaces in double quotes.

{marker lcolor}{...}
{phang}
    {opth lcolor(colorstyle)} specifies a custom outline color (syntax 2 only).
    The default is to use the same color for the outline as for the fill.

{marker lwidth}{...}
{phang}
    {opth lwidth(linewidthstyle)} specifies a custom outline thickness (syntax 2
    only). The default is {cmd:lwidth(vthin)}.

{marker palettes}{...}
{title:Palettes}

{marker s2}{...}
{dlgtab:s2}

{pstd}
    Palette {cmd:s2} ({stata colorpalette9 s2:{it:view}}) contains the 15 colors
    used for p1 to p15 in Stata's {helpb scheme s2:s2color} scheme. {cmd:s2} is
    the default palette.

{marker s1}{...}
{dlgtab:s1}

{pstd}
    Palette {cmd:s1} ({stata colorpalette9 s1:{it:view}}) contains the colors
    used for p1 to p15 in Stata's {helpb scheme s1:s1color} scheme.

{marker s1r}{...}
{dlgtab:s1r}

{pstd}
    Palette {cmd:s1r} ({stata colorpalette9 s1r:{it:view}}) contains the colors
    used for p1 to p15 in Stata's {helpb scheme s1:s1rcolor} scheme.

{marker economist}{...}
{dlgtab:economist}

{pstd}
    Palette {cmd:economist} ({stata colorpalette9 economist:{it:view}}) contains the colors
    used for p1 to p15 in Stata's {helpb scheme economist:economist} scheme.

{marker mono}{...}
{dlgtab:mono}

{pstd}
    Palette {cmd:mono} ({stata colorpalette9 mono:{it:view}}) contains the gray scales
    used for p1 to p15 in Stata's monochrome schemes ({helpb scheme s2:s2mono},
    {helpb scheme s1:s1mono}).

{marker cblind}{...}
{dlgtab:cblind}

{pstd}
    The {cmd:cblind} palette ({stata colorpalette9 cblind:{it:view}}) contains
    colorblind-friendly colors suggested by
    {browse "http://jfly.iam.u-tokyo.ac.jp/color/":Okabe and Ito (2002)}, including
    gray as suggested at
    {browse "http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/#a-colorblind-friendly-palette":www.cookbook-r.com}.
    The same colors are also used (in different order and using {cmd:gs10} for gray)
    in the {cmd:plotplainblind} and {cmd:plottigblind} schemes by
    {browse "http://www.stata-journal.com/article.html?article=gr0070":Bischof (2017b)}. Type
    {stata colorpalette9 cblind, select(1 2 4 5 9 8 7 3 6)} for a palette equivalent to
    the one used in {cmd:plotplainblind}, and
    {stata colorpalette9 cblind, select(1 4 5 9 8 7 3 6)} for {cmd:plottigblind}.

{marker plottig}{...}
{dlgtab:plottig}

{pstd}
    Palette {cmd:plottig} ({stata colorpalette9 plottig:{it:view}}) contains the colors
    used for p1 to p15 in the {cmd:plottig} scheme by
    {browse "http://www.stata-journal.com/article.html?article=gr0070":Bischof (2017b)}. Most of these colors
    are the same as the colors produced by the {helpb colorpalette9##hue:hue}
    color generator with default options ({stata colorpalette9 hue:{it:view}}), although
    in different order.

{marker 538}{...}
{dlgtab:538}

{pstd}
    Palette {cmd:538} ({stata colorpalette9 538:{it:view}}) contains the colors
    used for p1 to p6, background, labels, axes etc., and CIs
    in the {cmd:538} scheme by
    {browse "http://ideas.repec.org/c/boc/bocode/s458404.html":Bischof (2017a)}. The palette replicates colors
    used at {browse "http://fivethirtyeight.com":fivethirtyeight.com}.

{marker mrc}{...}
{dlgtab:mrc}

{pstd}
    Palette {cmd:mrc} ({stata colorpalette9 mrc:{it:view}}) contains the colors
    used for p1 to p7 in the {cmd:mrc} scheme by
    {browse "http://ideas.repec.org/c/boc/bocode/s457703.html":Morris (2013)}. These are colors
    according to guidelines by the UK Medical Research Council.

{marker tfl}{...}
{dlgtab:tfl}

{pstd}
    Palette {cmd:tfl} ({stata colorpalette9 tfl:{it:view}}) contains the colors
    used for p1 to p8 in the {cmd:tfl} scheme by
    {browse "http://ideas.repec.org/c/boc/bocode/s458103.html":Morris (2015)}. The palette replicates
    Transport for London's corporate colors.

{marker burd}{...}
{dlgtab:burd}

{pstd}
    Palette {cmd:burd} ({stata colorpalette9 burd:{it:view}}) contains the colors
    used for p1 to p9 and for CIs in the {cmd:burd} scheme by
    {browse "http://ideas.repec.org/c/boc/bocode/s457623.html":Briatte (2013)}. The p1 to p9
    colors are a selection of colors from various
    {browse "http://colorbrewer2.org/":ColorBrewer} schemes.

{marker lean}{...}
{dlgtab:lean}

{pstd}
    Palette {cmd:lean} ({stata colorpalette9 lean:{it:view}}) contains
    gray scales used for p1area to p15area in schemes {cmd:lean1} and {cmd:lean2}
    by {browse "http://www.stata-journal.com/article.html?article=gr0002":Juul (2003)}.

{marker hue}{...}
{dlgtab:hue}

{pstd}
    The {cmd:hue} palette implements an algorithm that generates HCL colors with
    evenly spaced hues. The palette has been modeled after function {cmd:hue_pal()} from
    R's {cmd:scales} package by Hadley Wickham (see {browse "http://github.com/hadley/scales"}). This
    is the default color scheme used by R's {cmd:ggplot2} for categorical data
    (see {browse "http://ggplot2.tidyverse.org/reference/scale_hue.html"}). The {cmd:hue} palette
    with default options produces the same colors as the
    {cmd:intense} scheme of the {helpb colorpalette9##hcl:hcl} color generator.

{pstd}
    Syntax:

{p 8 15 2}
    {cmd:hue} [{cmd:,} {opt h:ue(start end)} {opt c:hroma(#)} {opt l:uminance(#)}
        {opt dir:ection(#)} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    Options:

{phang}
    {opt hue(start end)} sets the range of hues on the 360 degree color
    wheel. The default is {bind:{cmd:hue(15 375)}}. If the difference between
    {it:start} and {it:end} is a multiple of 360, {it:end} will be reduced by
    360/n, where n is the number of requested colors (so that the space between
    the last and the first color is the same as between the other colors).

{phang}
    {opt chroma(#)} sets the colorfulness (color intensity), with
    {it:#} >= 0. The default is {cmd:chroma(100)}.

{phang}
    {opt luminance(#)} sets the brightness (amount of gray), with {it:#}
    in [0, 100]. The default is {cmd:luminance(65)}.

{phang}
    {opt direction(#)} determines the direction to travel around the color
    wheel. {cmd:direction(1)}, the default, travels clockwise; {cmd:direction(-1)}
    travels counter-clockwise.

{pstd}
    Examples:

        . {stata "colorpalette9: hue, n(3) / hue, n(5) / hue, n(7) / hue, n(9)"}
        . {stata colorpalette9 hue, n(5) hue(90 -30) chroma(50) luminance(70)}

{marker hcl}{...}
{dlgtab:hcl}

{pstd}
    The {cmd:hcl} palette is a HCL color generator (Hue-Chroma-Luminance). The
    implementation is based on R's {cmd:colorspace} package by
    {browse "http://CRAN.R-project.org/package=colorspace":Ihaka et al. (2016)}. Also
    see {browse "http://dx.doi.org/10.1016/j.csda.2008.11.033":Zeileis et al. (2009)}
    and {browse "http://hclwizard.org":hclwizard.org}.

{pstd}
    Let h1 and h2 be two hues on the 360 degree color wheel, c1 and c2 two
    chroma levels, l1 and l2 two luminance levels, p1 and p2 two power
    parameters, and i an index from 1 to n, where n is the number of requested
    colors. The HCL colors are then generated according to the following
    formulas.

        Qualitative:
            H = h1 + (h2 - h1) * (i - 1) / (n - 1)
            C = c1
            L = l1

        Sequential:
            H = h2 - (h2 - h1) * j
            C = c2 - (c2 - c1) * j^p1
            L = l2 - (l2 - l1) * j^p2
            with j = (n - i) / (n - 1)

        Diverging:
            H = cond(j > 0, h1, h2)
            C = c1 * abs(j)^p1
            L = l2 - (l2 - l1) * abs(j)^p2
            with j = (n - 2*j + 1) / (n - 1)

{pstd}
    Syntax:

{p 8 15 2}
    {cmd:hcl} [{cmd:,} {it:scheme} {opt h:ue(h1 [h2])} {opt c:hroma(c1 [c2])} {opt l:uminance(l1 [l2])}
        {opt pow:er(p1 [p2])} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    Options:

{phang}
    {it:scheme} picks the type of color formula (qualitative, sequential,
    or diverging) and sets the default parameter values. {it:scheme} can be one of
    following ({cmd:qualitative} is the default).

            Qualitative {...}
({stata "colorpalette9, lc(white) n(9): hcl, qual / hcl, intense / hcl, dark / hcl, light / hcl, pastel":{it:view}}){...}
{col 32} h1              h2   c1   l1
            {stata colorpalette9 hcl, qualitative:{bf:{ul:qual}itative}}{col 32} 15  h1+360*(n-1)/n   60   70
            {stata colorpalette9 hcl, intense:{bf:intense}}{*          }{col 32} 15  h1+360*(n-1)/n  100   65
            {stata colorpalette9 hcl, dark:{bf:dark}}{*                }{col 32} 15  h1+360*(n-1)/n   80   60
            {stata colorpalette9 hcl, light:{bf:light}}{*              }{col 32} 15  h1+360*(n-1)/n   50   80
            {stata colorpalette9 hcl, pastel:{bf:pastel}}{*            }{col 32} 15  h1+360*(n-1)/n   35   85

            Sequential {...}
({stata "colorpalette9, n(9): hcl, blues / hcl, greens / hcl, grays / hcl, oranges / hcl, purples / hcl, reds / hcl, heat / hcl, heat2 / hcl, terrain / hcl, terrain2 / hcl, viridis / hcl, plasma / hcl, redblue":{it:view}}){...}
{col 32} h1   h2   c1   c2   l1   l2   p1   p2
            {stata colorpalette9 hcl, sequential:{bf:{ul:seq}uential}}  {col 32}260   h1   80   10   25   95    1   p1
            {stata colorpalette9 hcl, blues:{bf:blues}}{*              }{col 32}260   h1   80   10   25   95    1   p1
            {stata colorpalette9 hcl, greens:{bf:greens}}{*            }{col 32}145  125   80   10   25   95    1   p1
            {stata colorpalette9 hcl, grays:{bf:grays}}{*              }{col 32}  0   h1    0    0   15   95    1   p1
            {stata colorpalette9 hcl, oranges:{bf:oranges}}{*          }{col 32} 40   h1  100   10   50   95    1   p1
            {stata colorpalette9 hcl, purples:{bf:purples}}{*          }{col 32}280   h1   70   10   20   95    1   p1
            {stata colorpalette9 hcl, reds:{bf:reds}}{*                }{col 32} 10   20   80   10   25   95    1   p1
            {stata colorpalette9 hcl, heat:{bf:heat}}{*                }{col 32}  0   90  100   30   50   90  0.2  1.0
            {stata colorpalette9 hcl, heat2:{bf:heat2}}{*              }{col 32}  0   90   80   30   30   90  0.2  2.0
            {stata colorpalette9 hcl, terrain:{bf:{ul:ter}rain}}{*     }{col 32}130    0   80    0   60   95  0.1  1.0
            {stata colorpalette9 hcl, terrain2:{bf:terrain2}}{*        }{col 32}130   30   65    0   45   90  0.5  1.5
            {stata colorpalette9 hcl, viridis:{bf:viridis}}{*          }{col 32}300   75   35   95   15   90  0.8  1.2
            {stata colorpalette9 hcl, plasma:{bf:plasma}}{*            }{col 32}100   h1   60  100   15   95  2.0  0.9
            {stata colorpalette9 hcl, redblue:{bf:redblue}}{*          }{col 32}  0 -100   80   40   40   75  1.0  1.0

            Diverging {...}
({stata "colorpalette9, n(9): hcl, bluered / hcl, bluered2 / hcl, bluered3 / hcl, greenorange / hcl, browngreen / hcl, pinkgreen / hcl, purplegreen":{it:view}}){...}
{col 32} h1   h2   c1   l1   l2   p1   p2
            {stata colorpalette9 hcl, diverging:{bf:{ul:div}erging}}    {col 32}260    0   80   30   95    1   p1
            {stata colorpalette9 hcl, bluered:{bf:bluered}}{*          }{col 32}260    0   80   30   95    1   p1
            {stata colorpalette9 hcl, bluered2:{bf:bluered2}}{*        }{col 32}260    0  100   50   95    1   p1
            {stata colorpalette9 hcl, bluered3:{bf:bluered3}}{*        }{col 32}180  330   60   75   95    1   p1
            {stata colorpalette9 hcl, greenorange:{bf:greenorange}}{*  }{col 32}130   45  100   70   95    1   p1
            {stata colorpalette9 hcl, browngreen:{bf:browngreen}}{*    }{col 32} 55  160   60   35   95    1   p1
            {stata colorpalette9 hcl, pinkgreen:{bf:pinkgreen}}{*      }{col 32}340  128   90   35   95    1   p1
            {stata colorpalette9 hcl, purplegreen:{bf:purplegreen}}{*  }{col 32}300  128   60   30   95    1   p1

{phang}
    {opt hue(h1 [h2])} overwrites the default values for h1 and h2. h1 and h2 are hues on
    the 360 degree color wheel.

{phang}
    {opt chroma(c1 [c2])} overwrites the default values for c1 and c2, with {it:c#} >= 0. c1 and c2
    determine the colorfulness (color intensity).

{phang}
    {opt luminance(l1 [l2])} overwrites the default values for l1 and l2, with {it:l#} in [0, 100]. l1 and l2
    determine the brightness (amount of gray).

{phang}
    {opt power(p1 [p2])} overwrites the default values for p1 and p2,
    with {it:p#} > 0. p1 and p2 determine the shape of the transition between
    chroma and luminance levels. For linear transitions, set {it:p#}=1; {it:p#}>1 makes
    the transition faster, {it:p#}<1 makes the transition slower.

{marker hsv}{...}
{dlgtab:hsv}

{pstd}
    The {cmd:hsv} palette is a HSV color generator (Hue-Saturation-Value). The
    implementation is partially based on R's {cmd:grDevices} package (which is
    part of the R core) and partially on {cmd:colorspace} by
    {browse "http://CRAN.R-project.org/package=colorspace":Ihaka et al. (2016)}.

{pstd}
    Let h1 and h2 be two hues on the 360 degree color wheel, s1 and s2 two
    saturation levels, v1 and v2 two value levels, p1 and p2 two power
    parameters, and i an index from 1 to n, where n is the number of requested
    colors. The HSV colors are then generated according to the following
    formulas.

        Qualitative:
            H = h1 + (h2 - h1) * (i - 1) / (n - 1)
            S = s1
            V = v1

        Sequential:
            H = h2 - (h2 - h1) * j
            S = s2 - (s2 - s1) * j^p1
            V = v2 - (v2 - v1) * j^p2
            with j = (n - i) / (n - 1)

        Diverging:
            H = cond(j > 0, h1, h2)
            S = s1 * abs(j)^p1
            V = v2 - (v2 - v1) * abs(j)^p2
            with j = (n - 2*j + 1) / (n - 1)

{pstd}
    Syntax:

{p 8 15 2}
    {cmd:hsv} [{cmd:,} {it:scheme} {opt h:ue(h1 [h2])} {opt sat:uration(s1 [s2])} {opt val:ue(v1 [v2])}
        {opt pow:er(p1 [p2])} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    Options:

{phang}
    {it:scheme} picks the type of color formula (qualitative, sequential,
    or diverging) and sets the default parameter values. {it:scheme} can be one of
    following ({cmd:qualitative} is the default).

            Qualitative {...}
({stata "colorpalette9, lc(white) n(9): hsv, qual / hsv, intense / hsv, dark / hsv, light / hsv, pastel / hsv, rainbow":{it:view}}){...}
{col 32} h1              h2   s1   v1
            {stata colorpalette9 hsv, qualitative:{bf:{ul:qual}itative}}{col 32} 15  h1+360*(n-1)/n   .4  .85
            {stata colorpalette9 hsv, intense:{bf:intense}}{*          }{col 32} 15  h1+360*(n-1)/n   .6  .9
            {stata colorpalette9 hsv, dark:{bf:dark}}{*                }{col 32} 15  h1+360*(n-1)/n   .6  .7
            {stata colorpalette9 hsv, light:{bf:light}}{*              }{col 32} 15  h1+360*(n-1)/n   .3  .9
            {stata colorpalette9 hsv, pastel:{bf:pastel}}{*            }{col 32} 15  h1+360*(n-1)/n   .2  .9
            {stata colorpalette9 hsv, rainbow:{bf:{ul:rain}bow}}{*     }{col 32} 15  h1+360*(n-1)/n    1   1

            Sequential {...}
({stata "colorpalette9, n(9): hsv, blues / hsv, greens / hsv, grays / hsv, oranges / hsv, purples / hsv, reds / hsv, heat / hsv, terrain":{it:view}}){...}
{col 32} h1   h2   s1   s2   v1   v2   p1   p2
            {stata colorpalette9 hsv, sequential:{bf:{ul:seq}uential}}  {col 32}240   h1   .8  .05   .6   1   1.2   p1
            {stata colorpalette9 hsv, blues:{bf:blues}}{*              }{col 32}240   h1   .8  .05   .6   1   1.2   p1
            {stata colorpalette9 hsv, greens:{bf:greens}}{*            }{col 32}140  120   1   .1    .3   1   1.2   p1
            {stata colorpalette9 hsv, grays:{bf:grays}}{*              }{col 32}  0   h1   0    0    .1  .95  1.0   p1
            {stata colorpalette9 hsv, oranges:{bf:oranges}}{*          }{col 32} 30   h1   1   .1    .9   1   1.2   p1
            {stata colorpalette9 hsv, purples:{bf:purples}}{*          }{col 32}270   h1   1   .1    .6   1   1.2   p1
            {stata colorpalette9 hsv, reds:{bf:reds}}{*                }{col 32}  0   20   1   .1    .6   1   1.2   p1
            {stata colorpalette9 hsv, heat:{bf:heat}}{*                }{col 32}  0   60   1   .2     1   1   0.3   p1
            {stata colorpalette9 hsv, terrain:{bf:{ul:ter}rain}}{*     }{col 32}120    0   1    0    .65 .95  0.7  1.5

            Diverging {...}
({stata "colorpalette9, n(9): hsv, bluered / hsv, bluered2 / hsv, bluered3 / hsv, greenorange / hsv, browngreen / hsv, pinkgreen / hsv, purplegreen":{it:view}}){...}
{col 32} h1   h2   s1   v1   v2   p1   p2
            {stata colorpalette9 hsv, diverging:{bf:{ul:div}erging}}    {col 32}240    0   .8   .6  .95  1.2   p1
            {stata colorpalette9 hsv, bluered:{bf:bluered}}{*          }{col 32}240    0   .8   .6  .95  1.2   p1
            {stata colorpalette9 hsv, bluered2:{bf:bluered2}}{*        }{col 32}240    0   .6   .8  .95  1.2   p1
            {stata colorpalette9 hsv, bluered3:{bf:bluered3}}{*        }{col 32}175  320   .6   .8  .95  1.2   p1
            {stata colorpalette9 hsv, greenorange:{bf:greenorange}}{*  }{col 32}130   40   1    .8  .95  1.2   p1
            {stata colorpalette9 hsv, browngreen:{bf:browngreen}}{*    }{col 32} 40  150   .8   .6  .95  1.2   p1
            {stata colorpalette9 hsv, pinkgreen:{bf:pinkgreen}}{*      }{col 32}330  120   .9   .6  .95  1.2   p1
            {stata colorpalette9 hsv, purplegreen:{bf:purplegreen}}{*  }{col 32}290  120   .7   .5  .95  1.2   p1

{phang}
    {opt h:ue(h1 [h2])} overwrites the default values for h1 and h2. h1 and h2
    are hues on the 360 degree color wheel.

{phang}
    {opt sat:uration(s1 [s2])} sets overwrites the default values for
    s1 and s2, with {it:s#} in [0, 1]. s1 and s2 determine the colorfulness
    (color intensity).

{phang}
    {opt val:ue(v1 [v2])} overwrites the default values for v1 and v2, with
    {it:v#} in [0, 1]. l1 and l2 determine the brightness (amount of gray).

{phang}
    {opt power(p1 [p2])} overwrites the default values for p1 and p2,
    with {it:p#} > 0. p1 and p2 determine the shape of the transition between
    saturation and value levels. For linear transitions, set {it:p#}=1; {it:p#}>1 makes
    the transition faster, {it:p#}<1 makes the transition slower.

{marker cbrew}{...}
{dlgtab:ColorBrewer}

{pstd}
    ColorBrewer is a set of color schemes developed by Brewer et al. (2003; also
    see Brewer 2016). The colors are licensed under Apache License Version 2.0; see
    the copyright notes at
    {browse "http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_updates.html":ColorBrewer_updates.html}. For
    more information on ColorBrewer also see {browse "http://colorbrewer2.org/"}. The
    RGB values for the implementation of the colors in {cmd:colorpalette9}
    have been taken from the Excel spreadsheet provided at
    {browse "http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_RGB.html":ColorBrewer_RGB.html}.
    The CMYK values have been taken from file cb.csv provided at
    {browse "http://github.com/axismaps/colorbrewer/":GitHub}. ColorBrewer palettes for Stata
    are also provided by {browse "http://github.com/matthieugomez/stata-colorscheme":Gomez (2015)}
    and by {browse "http://ideas.repec.org/c/boc/bocode/s458050.html":Buchanan (2015)}.

{pstd}The syntax for the ColorBrewer palettes is

{p 8 15 2}
    {it:scheme} [{cmd:,} {cmd:cmyk} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    where {it:scheme} is one of the following

{p2colset 13 28 30 2}{...}
{p2col:Qualitative ({stata "colorpalette9, lc(black): Accent / Dark2 / Paired / Pastel1 / Pastel2 / Set1 / Set2 / Set3":{it:view}})}{p_end}
{p2col:{stata colorpalette9 Accent:{bf:Accent}}}8 accented colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Dark2:{bf:Dark2}}}8 dark colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Paired:{bf:Paired}}}12 paired colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Pastel1:{bf:Pastel1}}}9 pastel colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Pastel2:{bf:Pastel2}}}8 pastel colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Set1:{bf:Set1}}}9 colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Set2:{bf:Set2}}}8 colors for qualitative data{p_end}
{p2col:{stata colorpalette9 Set3:{bf:Set3}}}12 colors for qualitative data{p_end}

{p2col:Sequential (single hue) ({stata "colorpalette9: Blues / Greens / Greys / Oranges / Purples / Reds":{it:view}})}{p_end}
{p2col:{stata colorpalette9 Blues:{bf:Blues}}}light blue to blue (3-9 colors){p_end}
{p2col:{stata colorpalette9 Greens:{bf:Greens}}}light green to green (3-9 colors){p_end}
{p2col:{stata colorpalette9 Greys:{bf:Greys}}}light gray to gray (3-9 colors){p_end}
{p2col:{stata colorpalette9 Oranges:{bf:Oranges}}}light orange to orange (3-9 colors){p_end}
{p2col:{stata colorpalette9 Purples:{bf:Purples}}}light purple to purple (3-9 colors){p_end}
{p2col:{stata colorpalette9 Reds:{bf:Reds}}}light red to red (3-9 colors){p_end}

{p2col:Sequential (multi-hue) ({stata "colorpalette9: BuGn / PuBu / GnBu / OrRd / PuBu / PuBuGn / PuRd / RdPu / YlGn / YlGnBu / YlOrBr / YlOrRd":{it:view}})}{p_end}
{p2col:{stata colorpalette9 BuGn:{bf:BuGn}}}light blue to green (3-9 colors){p_end}
{p2col:{stata colorpalette9 BuPu:{bf:BuPu}}}light blue to purple (3-9 colors){p_end}
{p2col:{stata colorpalette9 GnBu:{bf:GnBu}}}light green to blue (3-9 colors){p_end}
{p2col:{stata colorpalette9 OrRd:{bf:OrRd}}}light orange to red (3-9 colors){p_end}
{p2col:{stata colorpalette9 PuBu:{bf:PuBu}}}light purple to blue (3-9 colors){p_end}
{p2col:{stata colorpalette9 PuBuGn:{bf:PuBuGn}}}light purple over blue to green (3-9 colors){p_end}
{p2col:{stata colorpalette9 PuRd:{bf:PuRd}}}light purple to red (3-9 colors){p_end}
{p2col:{stata colorpalette9 RdPu:{bf:RdPu}}}light red to purple (3-9 colors){p_end}
{p2col:{stata colorpalette9 YlGn:{bf:YlGn}}}light yellow to green (3-9 colors){p_end}
{p2col:{stata colorpalette9 YlGnBu:{bf:YlGnBu}}}light yellow over green to blue (3-9 colors){p_end}
{p2col:{stata colorpalette9 YlOrBr:{bf:YlOrBr}}}light yellow over orange to brown (3-9 colors){p_end}
{p2col:{stata colorpalette9 YlOrRd:{bf:YlOrRd}}}light yellow over orange to red (3-9 colors){p_end}

{p2col:Diverging ({stata "colorpalette9: BrBG / PRGn / PiYG / PuOr / RdBu / RdGy / RdYlBu / RdYlGn / Spectral":{it:view}})}{p_end}
{p2col:{stata colorpalette9 BrBG:{bf:BrBG}}}brown to green, light gray mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 PiYG:{bf:PiYG}}}pink to green, light gray mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 PRGn:{bf:PRGn}}}purple to green, light gray mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 PuOr:{bf:PuOr}}}purple to orange, light gray mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 RdBu:{bf:RdBu}}}red to blue, light gray mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 RdGy:{bf:RdGy}}}red to gray, white mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 RdYlBu:{bf:RdYlBu}}}red to blue, yellow mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 RdYlGn:{bf:RdYlGn}}}red to green, yellow mid (3-11 colors){p_end}
{p2col:{stata colorpalette9 Spectral:{bf:Spectral}}}red - orange - yellow - green - blue (3-11 colors){p_end}

{phang}
    and option {cmd:cmyk} requests the CMYK variant of the scheme. The default is to use
    the RGB variant.

{marker ptol}{...}
{dlgtab:ptol}

{pstd}
    The {cmd:ptol} collection provides color schemes suggested by
    {browse "https://personal.sron.nl/~pault/colourschemes.pdf":Tol (2012)}. The
    syntax is

{p 8 15 2}
    {cmd:ptol} [{cmd:,} {it:scheme} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    where {it:scheme} is one of the following
    ({stata "colorpalette9: ptol, n(3) / ptol, n(5) / ptol, n(9) / ptol, div n(3) / ptol, div n(5) / ptol, div n(9) / ptol, rain n(4) / ptol, rain n(6) / ptol, rain n(8)":{it:view}}).

{p2colset 13 28 30 2}{...}
{p2col:{stata colorpalette9 ptol, qualitative:{bf:{ul:qual}itative}}}1-12 qualitative colors; the default{p_end}
{p2col:{stata colorpalette9 ptol, diverging:{bf:{ul:div}erging}}}3-11 diverging colors; very similar to reverse {cmd:RdYlBu}{p_end}
{p2col:{stata colorpalette9 ptol, rainbow:{bf:{ul:rain}bow}}}4-12 rainbow colors{p_end}

{marker d3}{...}
{dlgtab:d3}

{pstd}
    The {cmd:d3} collection provides color schemes from
    {browse "http://d3js.org/":D3.js}, using the color values found at
    {browse "https://github.com/d3/d3-scale/blob/master/README.md#category-scales":github.com/d3}. The
    syntax is

{p 8 15 2}
    {cmd:d3} [{cmd:,} {it:scheme} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    where {it:scheme} is one of the following
    ({stata "colorpalette9: d3, 10 / d3, 20 / d3, 20b / d3, 20c":{it:view}}).

{p2colset 13 20 22 2}{...}
{p2col:{stata colorpalette9 d3, 10:{bf:10}}}10 categorical colors; the default; same as first 10 colors in {cmd:tableau}{p_end}
{p2col:{stata colorpalette9 d3, 20:{bf:20}}}20 categorical colors in pairs; same colors as in {cmd:tableau}, but ordered differently{p_end}
{p2col:{stata colorpalette9 d3, 20b:{bf:20b}}}20 categorical colors in groups of four{p_end}
{p2col:{stata colorpalette9 d3, 20c:{bf:20c}}}20 categorical colors in groups of four{p_end}

{marker lin}{...}
{dlgtab:lin}

{pstd}
    The {cmd:lin} collection provides semantic color schemes suggested by
    {browse "http://dx.doi.org/10.1111/cgf.12127":Lin et al. (2013)}. The values
    of the semantic colors have been taken from the source code of the
    {cmd:brewscheme} package by
    {browse "http://ideas.repec.org/c/boc/bocode/s458050.html":Buchanan (2015)} (brewextra.ado,
    version 1.0.0, 21 March 2016); the values of the {cmd:tableau} palette
    have been taken from code provided by the authors at
    {browse "http://github.com/StanfordHCI/semantic-colors":GitHub}.

{pstd}The syntax is

{p 8 15 2}
    {cmd:lin} [{cmd:,} {it:scheme} {opt a:lgorithm} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    where {it:scheme} is one of the following

{p2colset 13 28 30 2}{...}
{p2col:{stata colorpalette9 lin, tableau rows(10):{bf:{ul:tab}leau}}}20 categorical colors; the default{p_end}
{p2col:{stata colorpalette9 lin, carcolor:{bf:{ul:car}color}}}6 car colors{p_end}
{p2col:{stata colorpalette9 lin, food:{bf:food}}}7 food colors{p_end}
{p2col:{stata colorpalette9 lin, features:{bf:{ul:feat}ures}}}5 feature colors{p_end}
{p2col:{stata colorpalette9 lin, activities:{bf:{ul:act}ivities}}}5 activity colors{p_end}
{p2col:{stata colorpalette9 lin, fruits:{bf:{ul:fruit}s}}}7 fruit colors{p_end}
{p2col:{stata colorpalette9 lin, vegetables:{bf:{ul:veg}etables}}}7 vegetable colors{p_end}
{p2col:{stata colorpalette9 lin, drinks:{bf:{ul:drink}s}}}7 drinks colors{p_end}
{p2col:{stata colorpalette9 lin, brands:{bf:{ul:brand}s}}}7 brands colors{p_end}

{pstd}
    and option {opt algorithm} requests algorithm selected colors. The default is to
    return the colors selected by Turkers (in case of {cmd:carcolor}, {cmd:food},
    {cmd:features}, {cmd:activities}) or by the expert
    (in case of {cmd:fruits}, {cmd:vegetables}, {cmd:drinks},
    {cmd:brands}). {opt a:lgorithm} has no effect for {cmd:tableau}.

{marker spmap}{...}
{dlgtab:spmap}

{pstd}
    The {cmd:spmap} collection provides color schemes from the {cmd:spmap}
    package by {browse "http://ideas.repec.org/c/boc/bocode/s456812.html":Pisati (2007)}. The
    implementation is based on code from spmap_color.ado (version 1.3.0, 13 March 2017).

{pstd}
    The syntax is

{p 8 15 2}
    {cmd:spmap} [{cmd:,} {it:scheme} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    where {it:scheme} is one of the following
    ({stata "colorpalette9, n(16) lc(white): spmap, bl / spmap, green / spmap, grey / spmap, red / spmap, rain / spmap, heat / spmap, ter / spmap, top":{it:view}}).

{p2colset 13 28 30 2}{...}
{p2col:{stata colorpalette9 spmap, blues:{bf:{ul:bl}ues}}}light blue to blue (2-99 colors); the default{p_end}
{p2col:{stata colorpalette9 spmap, greens:{bf:{ul:green}s}}}light green to green (2-99 colors){p_end}
{p2col:{stata colorpalette9 spmap, greys:{bf:{ul:grey}s}}}light gray to black (2-99 colors){p_end}
{p2col:{stata colorpalette9 spmap, reds:{bf:{ul:red}s}}}light red to red (2-99 colors){p_end}
{p2col:{stata colorpalette9 spmap, rainbow:{bf:{ul:rain}bow}}}2-99 rainbow colors{p_end}
{p2col:{stata colorpalette9 spmap, heat:{bf:heat}}}2-16 heat colors{p_end}
{p2col:{stata colorpalette9 spmap, terrain:{bf:{ul:ter}rain}}}2-16 terrain colors{p_end}
{p2col:{stata colorpalette9 spmap, topological:{bf:{ul:top}ological}}}2-16 topological colors{p_end}

{marker sfso}{...}
{dlgtab:sfso}

{pstd}
    The {cmd:sfso} collection provides color schemes by the Swiss Federal Statistical
    Office (using hex and CMYK codes found in Bundesamt f{c u:}r Statistik 2017). The
    syntax is

{p 8 15 2}
    {cmd:sfso} [{cmd:,} {it:scheme} {cmd:cmyk} {help colorpalette9##opts:{it:palette_options}} ]

{pstd}
    where {it:scheme} is one of the following

{p2colset 13 28 30 2}{...}
{p2col:Sequential ({stata "colorpalette9: sfso, br / sfso, or / sfso, red / sfso, pi / sfso, pu / sfso, vi / sfso, bl / sfso, ltbl / sfso, tu / sfso, green / sfso, ol / sfso, black":{it:view}})}{p_end}
{p2col:{stata colorpalette9 sfso, brown:{bf:{ul:br}own}}}dark brown to light brown (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, orange:{bf:{ul:or}ange}}}dark orange to light orange (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, red:{bf:red}}}dark red to light red (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, pink:{bf:{ul:pi}nk}}}dark pink to light pink (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, purple:{bf:{ul:pu}rple}}}dark purple to light purple (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, violet:{bf:{ul:vi}olet}}}dark violet to light violet (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, blue:{bf:{ul:bl}ue}}}dark blue to light blue (7 colors); the default{p_end}
{p2col:{stata colorpalette9 sfso, ltblue:{bf:{ul:ltbl}ue}}}lighter version of {cmd:blue} (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, turquoise:{bf:{ul:tu}rquoise}}}dark turquoise to light turquoise (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, green:{bf:green}}}dark green to light green (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, olive:{bf:{ul:ol}ive}}}dark olive to light olive (6 colors){p_end}
{p2col:{stata colorpalette9 sfso, black:{bf:black}}}dark gray to light gray (6 colors){p_end}

{p2col:Semantic ({stata "colorpalette9: sfso, parties / sfso, languages / sfso, votes":{it:view}})}{p_end}
{p2col:{stata colorpalette9 sfso, parties:{bf:parties}}}colors used by the SFSO for Swiss parties (11 colors){p_end}
{p2col:{stata colorpalette9 sfso, languages:{bf:{ul:lang}uages}}}colors used by the SFSO for languages (5 colors){p_end}
{p2col:{stata colorpalette9 sfso, votes:{bf:{ul:vote}s}}}colors used by the SFSO for results from votes (10 colors){p_end}

{phang}
    and option {cmd:cmyk} requests the CMYK variant of the scheme. The default is to use
    the RGB variant.

{marker colorlist}{...}
{dlgtab:colorlist}

{pstd}
    Instead of using a named color palette you can provide a custom palette by
    specifying a list of {help colorstyle##colorstyle:{it:colorstyles}} (named colors,
    RBG colors specified as {cmd:"}{it:# # #}{cmd:"}, CMYK colors specified as {cmd:"}{it:# # # #}{cmd:"},
    or HSV colors specified as {cmd:"hsv} {it:# # #}{cmd:"}). Example (navy in 4 different ways):

        . {stata colorpalette9 navy "26 71 111" "85 40 0 144" "hsv 209 .766 .435"}

{pstd}
    It is also possible to specify RGB colors using their 6-digit hex codes
    (or 3-digit abbreviations; see
    {browse "http://en.wikipedia.org/wiki/Web_colors":en.wikipedia.org/wiki/Web_colors}
    for background information; some websites providing collections of colors are
    {browse "http://www.w3schools.com/colors/":www.w3schools.com/colors},
    {browse "http://htmlcolorcodes.com/":htmlcolorcodes.com}, or
    {browse "http://www.color-hex.com/":www.color-hex.com}). Start the color specification
    with a hash in this case. The hex codes will be translated to RGB. Example:

        . {stata colorpalette9 #30C #3300cc #FFC0CB #ffc0cb}

{pstd}
    Furthermore, HCL colors can be provided as
    {cmd:"hcl} {it:# # #}{cmd:"}, where the first number specifies the hue
    (dominant wavelength in degrees of the 360 degree color wheel), the second
    number specifies the chroma (colorfulness, color intensity; # >= 0) and the
    third number specifies the luminance (brightness, amount of gray; # in [0,
    100]). HCL colors will be translated to RGB. Example:

        . {stata colorpalette9 "hcl 0 100 70" "hcl 120 100 70" "hcl 240 100 70"}

{pstd}
    Color intensity adjustment may be requested by adding adjustment factor
    {cmd:*}{it:#} to a color. Example (original navy and navy with 70%
    intensity in 3 different ways):

        . {stata colorpalette9 navy navy*.7 "26 71 111*.7" #1a476f*.7}

{pstd}
    Furthermore, since Stata 15, colors may be complemented by opacity specified as
    {cmd:%}{it:#}. Example (original navy and navy with 80% opacity in 3 different ways):

        . {stata colorpalette9 navy navy%80 "26 71 111%80" #1a476f%80}

{pstd}
    Intensity and opacity can be combined:

        . {stata colorpalette9 navy navy*.7 navy%80 navy*.7%80}

{marker myname}{...}
{dlgtab:myname}

{pstd}
    A personal named palette can be provided in form of a program called
    {cmd:colorpalette9_}{it:myname}, where {it:myname} is the name of the
    palette. Palette {it:myname} will then be available to {cmd:colorpalette9}
    like any other palette. Your program should return the color definitions as
    a comma-separated list in local macro {cmd:P}. In addition you may provide
    a comma-separated list of descriptions in local macro {cmd:I}. For example,
    the following program provides a palette called {cmd:bootstrap3} containing
    the semantic colors used for buttons in
    {browse "http://getbootstrap.com/docs/3.3":Bootstrap v3.3}:

        {com}program colorpalette9_bootstrap3
            c_local P #ffffff,#337ab7,#5cb85c,#5bc0de,#f0ad4e,#d9534f, ///
                      #e6e6e6,#286090,#449d44,#31b0d5,#ec971f,#c9302c
            c_local I default,primary,success,info,warning,danger,default.focus, ///
                primary.focus,success.focus,info.focus,warning.focus,danger.focus
        end{txt}

{pstd}
    After defining the program, you can, for example, type

        {com}. colorpalette9 bootstrap3, rows(6){txt}

{pstd}
    to view the palette. More complicated definitions of palettes that
    take account of options are also possible. See the palette definitions
    {stata viewsource colorpalette9.ado:colorpalette9.ado} for examples.


{marker examples}{...}
{title:Example}

{pstd}
    Apart from viewing color palettes, {cmd:colorpalette9} is useful for
    retrieving colors that can then be passed through to a graph command. Here is
    an example of a contour plot using the {cmd:terrain} scheme from
    the {cmd:hcl} palette:

        . {stata sysuse sandstone, clear}
        . {stata colorpalette9 hcl, terrain n(10) nograph}
        . {stata twoway contour depth northing easting, levels(`r(n)') ccolors(`r(p)')}


{marker returns}{...}
{title:Saved results}

{pstd}
    {cmd:colorpalette9} stores the following in {cmd:r()} (Syntax 1 only):

{synoptset 16 tabbed}{...}
{p2col 5 16 20 2: Scalars}{p_end}
{synopt:{cmd:r(n)}}number of returned colors{p_end}

{synoptset 16 tabbed}{...}
{p2col 5 16 20 2: Macros}{p_end}
{synopt:{cmd:r(ptype)}}{cmd:color}{p_end}
{synopt:{cmd:r(pname)}}name of palette or {cmd:custom}{p_end}
{synopt:{cmd:r(pnote)}}additional information on palette (if provided){p_end}
{synopt:{cmd:r(p)}}space separated list of colors{p_end}
{synopt:{cmd:r(p#)}}#th color{p_end}
{synopt:{cmd:r(p#info)}}info of #th color (if provided){p_end}


{marker references}{...}
{title:References}

{phang}
    Bischof, D. 2017a. G538SCHEMES: module to provide graphics schemes for
    http://fivethirtyeight.com. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s458404.html"}.
    {p_end}
{phang}
    Bischof, D. 2017b. {browse "http://www.stata-journal.com/article.html?article=gr0070":New graphic schemes for Stata: plotplain and plottig}.
    The Stata Journal 17(3): 748–759.
    {p_end}
{phang}
    Briatte, F. 2013. SCHEME-BURD: Stata module to provide a
    ColorBrewer-inspired graphics scheme with qualitative and blue-to-red
    diverging colors. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s457623.html"}.
    {p_end}
{phang}
    Brewer, C. A., G. W. Hatchard, M. A. Harrower. 2003. {browse "http://doi.org/10.1559/152304003100010929":ColorBrewer in Print: A Catalog of Color Schemes for Maps}.
    Cartography and Geographic Information Science 30(1): 5–32.
    {p_end}
{phang}
    Brewer, C. A. 2016. Designing Better Maps. A Guide for GIS Users. 2nd ed. Redlands, CA: Esri Press.
    {p_end}
{phang}
    Buchanan, B. 2015. BREWSCHEME: Stata module for generating customized
    graph scheme files. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s458050.html"}.
    {p_end}
{phang}
    Bundesamt f{c u:}r Statistik 2017. Layoutrichtlinien. Gestaltungs und
    Redaktionsrichtlinien für Publikationen, Tabellen und grafische
    Assets. Version 1.1.1. Neuchâtel.
    {p_end}
{phang}
    Gomez, M. 2015. Stata command to generate color schemes. Available from
    {browse "http://github.com/matthieugomez/stata-colorscheme"}.
    {p_end}
{phang}
    Ihaka, R., P. Murrell, K. Hornik, J. C. Fisher, R. Stauffer, A. Zeileis.
    2016. colorspace: Color Space Manipulation. R package version 1.3-2.
    Available from {browse "http://CRAN.R-project.org/package=colorspace"}.
    {p_end}
{phang}
    Juul, S. 2003. {browse "http://www.stata-journal.com/article.html?article=gr0002":Lean mainstream schemes for Stata 8 graphics}. The Stata
    Journal 3(3): 295-301.
    {p_end}
{phang}
    Lin, S., J. Fortuna, C. Kulkarni, M. Stone,
    J. Heer. 2013. {browse "http://dx.doi.org/10.1111/cgf.12127":Selecting Semantically-Resonant Colors for Data Visualization}. Computer
    Graphics Forum 32(3pt4): 401-410.
    {p_end}
{phang}
    Morris, T. 2013. SCHEME-MRC: Stata module to provide graphics scheme for UK
    Medical Research Council. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s457703.html"}.
    {p_end}
{phang}
    Morris, T. 2015. SCHEME-TFL: Stata module to provide graph scheme, based on
    Transport for London's corporate colour pallette. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s458103.html"}.
    {p_end}
{phang}
    Okabe, M., K. Ito. 2002. Color Universal Design (CUD). How to make figures and presentations that
    are friendly to Colorblind people. Available from
    {browse "http://jfly.iam.u-tokyo.ac.jp/color/"}.
    {p_end}
{phang}
    Pisati, M. 2007. SPMAP: Stata module to visualize spatial data. Available
    from {browse "http://ideas.repec.org/c/boc/bocode/s456812.html"}.
    {p_end}
{phang}
    Tol, P. 2012. Colour Schemes. SRON Technical Note, Doc. no. SRON/EPS/TN/09-002. Available
    from {browse "https://personal.sron.nl/~pault/colourschemes.pdf"}.
    {p_end}
{phang}
    Zeileis, A., K. Hornik, P. Murrell. 2009.
    {browse "http://dx.doi.org/10.1016/j.csda.2008.11.033":Escaping RGBland: Selecting Colors for Statistical Graphics}.
    Computational Statistics & Data Analysis 53: 3259-3270.
    {p_end}


{marker author}{...}
{title:Author}

{pstd}
    Ben Jann, University of Bern, ben.jann@soz.unibe.ch

{pstd}
    Thanks for citing this software as

{pmore}
    Jann, B. (2018). {browse "https://www.stata-journal.com/article.html?article=gr0075":Color palettes for Stata graphics}. The Stata Journal
    18(4): 765-785.

{pstd}
    or

{pmore}
    Jann, B. (2017). palettes: Stata module providing color palettes, symbol
    palettes, and line pattern palettes. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s458444.html"}.


{marker alsosee}{...}
{title:Also see}

{psee}
    Online:  help for {helpb colorpalette}, {helpb symbolpalette}, {helpb linepalette}, {helpb grstyle set}, {helpb graph}, {help colorstyle}

