help colorpalette                            http://repec.sowi.unibe.ch/stata/palettes/
(PDF manual)                                        http://github.com/benjann/palettes/
---------------------------------------------------------------------------------------

Title

    colorpalette -- Color palettes


Syntax

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

        colorpalette [argument] [, palette_options macro_options graph_options ]

    where argument is

        palette [[, palette_options] / [ palette [, palette_options] / ... ]]

    Syntax 2: Display an overview of multiple palettes

        colorpalette [, palette_options graph_options ] : pspec [ / pspec / ... ]

    where pspec is

        palette [, palette_options]

    or . to insert a gap.

    Analyze colors after applying colorpalette (Syntax 1 only)

        colorcheck [, check_options ]


    palette               Description
    ---------------------------------------------------------------------------------
    Color list
      colorlist           custom list of colors

    Stata palettes (view)
      s2                  15 colors as in Stata's s2color scheme; the default
      s1                  15 colors as in Stata's s1color scheme
      s1r                 15 colors as in Stata's s1rcolor scheme
      economist           15 colors as in Stata's economist scheme
      mono                15 gray scales as in Stata's monochrome schemes

    Other palettes (view)
      okabe               8 colorblind-friendly colors by Okabe and Ito (2002)
      cblind              like okabe, but including gray on second position
      plottig             15 colors as in plottig by Bischof (2017b)
      538                 6 + 7 colors as in 538 by Bischof (2017a)
      mrc                 7 colors as in mrc by Morris (2015)
      tfl                 8 colors as in tfl by Morris (2013)
      burd                9 + 4 colors as in burd by Briatte (2013)
      lean                15 gray scales as in lean by Juul (2003)
      tableau             20 categorical colors by Lin et al. (2013)

    Color generators
      hue                 evenly spaced HCL hues
      HCL | LCh | JMh     HCL, LCh, or J'M'h color generator
      HSV | HSL           HSV or HSL color generator

    Collections
      pals                categorical palettes from the pals package in R
      d3                  categorical palettes from D3.js
      sb                  categorical palettes from seaborn.pydata.org
      tab                 color schemes from Tableau 10
      tol                 color schemes by Paul Tol from personal.sron.nl/~pault
      ptol                color schemes from Tol (2012)
      colorbrewer         ColorBrewer palettes
      carto               color schemes from carto.com/carto-colors
      viridis             perceptually uniform colormaps from matplotlib.org
      seaborn             perceptually uniform colormaps from seaborn.pydata.org
      matplotlib          further colormaps from matplotlib.org
      CET                 perceptually uniform colormaps by Kovesi (2015)
      scico               perceptually uniform colorblind-friendly colormaps by
                            Crameri (2018)
      lin                 semantic colors schemes by Lin et al. (2013)
      spmap               color schemes from spmap by Pisati (2007)
      sfso                color schemes used by the Swiss Federal Statistical Office
      HTML                categorical HTML colors from www.w3schools.com
      w3                  W3.CSS colors from www.w3schools.com
      wesanderson         Wes Anderson palettes from wesandersonpalettes.tumblr.com

    Custom
      myname              custom palette provided by program colorpalette_myname
      mata(name)          custom palette provided by ColrSpace object name
    ---------------------------------------------------------------------------------
    Palette names can be abbreviated and typed in lowercase letters; if abbreviation
    is ambiguous, the first matching palette in the sorted will be used.


    palette_options       Description
    ---------------------------------------------------------------------------------
    Main
      n(#)                size of the palette (number of colors)
      select(numlist)     select (and order) the colors
      drop(numlist)       drop individual colors
      order(numlist)      order the colors
      reverse             arrange palette in reverse order
      shift(#)            shift the positions of the colors
      opacity(numlist)    set opacity, in percent
      intensity(numlist)  set color intensity multipliers
      ipolate(spec)       interpolate the colors
      intensify(numlist)  modify intensity
      saturate(spec)      modify saturation (colorfulness)
      luminate(spec)      modify luminance (brightness)
      gscale[(spec)]      convert to grayscale
      cblind[(spec)]      simulate color vision deficiency
      other               palette-specific options

    Technical
      forcergb            enforce translation to RGB
      noexpand            omit automatic interpolation/recycling
      class(class)        set palette class
      name(str)           assign a palette name
    ---------------------------------------------------------------------------------


    macro_options         Description
    ---------------------------------------------------------------------------------
      globals[(spec)]     store color codes in global macros
      locals[(spec)]      store color codes in local macros
      stylefiles[(spec)]  store color codes in style files
    ---------------------------------------------------------------------------------


    graph_options         Description
    ---------------------------------------------------------------------------------
    Main
      title(string)       custom graph title
      nonumbers           omit color IDs
      gropts(options)     options passed through to graph command

    Syntax 1 only
      rows(#)             minimum number of rows; default is 5
      names               print names instead of codes (if available)
      noinfo              suppress additional color info
      nograph             do not generate a graph
      graph               enforce crating the graph

    Syntax 2 only
      horizontal          horizontal plot; the default
      vertical            vertical plot
      span                use all available space for each palette
      barwidth(#)         width of bars
      labels(strlist)     custom palette labels
      lcolor(colorstyle)  custom outline color
      lwidth(lwstyle)     custom outline thickness
    ---------------------------------------------------------------------------------


    check_options         Description
    ---------------------------------------------------------------------------------
    Main
      metric(metric)      color difference metric
      mono(spec)          grayscale conversion settings
      cvd(#)              severity of color vision deficiency

    Graph
      nograph             do not generate a graph
      sort[(spec)]        sort the colors in the graph
      graph_options       syntax 2 graph option
    ---------------------------------------------------------------------------------


Description

    colorpalette is a utility command to retrieve or display color palettes. A large
    collection of named colors, palettes, colormaps, and color generators is provided
    and color codes can be entered various formats (including, e.g., hex colors).
    Furthermore, colorpalette provides advances features such as color interpolation,
    grayscale conversion, or color vision deficiency simulation. Palette entries are
    returned in r() or, optionally, as global or local macros or as style files.

    colorcheck analyzes the colors returned by colorpalette by applying grayscale
    conversion and color vision deficiency transformation, and by computing minimum
    color differences among the converted colors. The purpose of the command is to
    evaluate whether the colors will be distinguishable by people who suffer from
    color vision deficiency and also whether the colors will be distinguishable in
    (non-color) print. The smallest noticeable difference between two colors has a
    color difference value (Delta E) of 1.0. A value of, say, 10 seems a reasonable
    minimum difference for colors used to display different features of data.
    colorcheck operates on the results returned by colorpalette (Syntax 1 only) and
    can be applied repeatedly (see example).

    colorpalette requires version 14.2 of Stata or newer. Users of older Stata
    versions can use command colorpalette9, which has limited functionality but runs
    under Stata 9.2 or newer.

    colorpalette requires the colrspace package to be installed; type ssc install
    colrspace.


Options

        +-----------------+
    ----+ Palette options +----------------------------------------------------------

    n(#) specifies the size of the palette (the number of colors). Many palettes,
        such as, e.g., the color generators or the sequential and diverging
        ColorBrewer palettes, are adaptive to n() in the sense that they return
        different colors depending on n(). Other palettes, such as s2, contain a
        fixed set of colors. If n() is different from the (maximum or minimum) number
        of colors defined by a palette, the colors are either recycled or
        interpolated, depending on the class of the palette; see option class()
        below. To prevent automatic recycling/interpolation, specify option noexpand
        (see below).

    select(numlist) selects (and reorders) the colors retrieved from the palette.
        Positive numbers refer to positions from the start; negative numbers refer to
        positions from the end. Only one of select() and order() is allowed; only one
        of select() and drop() is allowed. select() is applied after n() has taken
        effect.

    drop(numlist) drops individual colors retrieved from the palette. Positive
        numbers refer to positions from the start; negative numbers refer to
        positions from the end. Only one of select() and drop() is allowed. drop() is
        applied after n() has taken effect.

    order(numlist) reorders the colors. Positive numbers refer to positions from the
        start; negative numbers refer to positions from the end. Colors not covered
        in numlist will be placed last, in their original order. Only one of order()
        and select() is allowed. order() is applied after n() and drop() have taken
        effect.

    reverse returns the colors in reverse order. reverse is applied after n(),
        select(), drop(), and order() have taken effect.

    shift(#) shifts the positions of the colors up (if #>0) or down (if #<0),
        wrapping positions around at the end. If # is in (-1,1), the colors are
        shifted by trunc(#*n) positions, where n is the size of the palette
        (proportional shift); if abs(#)>=1, the colors are shifted by trunc(#)
        positions. shift() is applied after n(), select(), drop(), order(), and
        reverse have taken effect.

    opacity(numlist) sets the opacity level(s) (Stata 15 required). The values in
        numlist must be between 0 (fully transparent) and 100 (fully opaque). Specify
        multiple values to use different opacity levels across the colors. If the
        number of specified opacity levels is smaller than the number of colors, the
        levels will be recycled; if the number of opacity levels is larger than the
        number of colors, the colors will be recycled. To skip assigning opacity to a
        particular color, you may set the corresponding element to . (missing).
        opacity() is applied after n(), select(), drop(), order(), reverse, and
        shift() have taken effect.

    intensity(numlist) sets the color intensity adjustment multipliers.  The values
        in numlist must be between 0 and 255. Values below 1 make the colors lighter;
        values larger than 1 make the colors darker (although the allowed scale goes
        up to 255, values as low as 5 or 10 may already make a color black). Specify
        multiple values to assign different multipliers across the colors. If the
        number of specified multipliers is smaller than the number of colors, the
        multipliers will be recycled; if the number of multipliers is larger than the
        number of colors, the colors will be recycled. To skip assigning an intensity
        multiplier to a particular color, you may set the corresponding element to .
        (missing).  intensity() is applied after n(), select(), drop(), order(),
        reverse, and shift() have taken effect.

        Example: colorpalette "189 30 36", intensity(0.1(.05)1) name(Reds)

    ipolate(n[, suboptions]) interpolates the colors to a total of n colors.
        ipolate() is applied after n(), select(), drop(), order(), reverse, shift(),
        opacity(), and intensity() have taken effect (intensity multipliers and
        opacity levels, if defined, will also be interpolated).

        Example: colorpalette cranberry dkorange, ipolate(5) name(red to orange)

        Suboptions are as follows.

        cspace selects the color space in which the colors are interpolated. The
            default space is Jab (perceptually uniform CIECAM02-based J'a'b'). Other
            possibilities are, for example, RGB, lRGB, Lab, LCh, Luv, HCL, JMh, or
            HSV; see help colrspace for details.

            Example: colorpalette: #fafa6e #2a4858, ipolate(10) name(Jab) / #fafa6e
            #2a4858, ipolate(10, JMh) name(JMh)

        range(lb [ub]) sets the interpolation range, where lb and ub are the lower
            and upper bounds. The default is range(0 1). If lb is larger than ub, the
            colors are returned in reverse order. Extrapolation will be applied if
            the specified range exceeds [0,1].

            Example: colorpalette: #fafa6e #2a4858, ipolate(11, HCL) name([0,1]) /
            #fafa6e #2a4858, ipolate(6, HCL range(0 .5)) name([0,.5])

        power(#), with # > 0, determines how the destination colors are distributed
            across the interpolation range. The default is to distribute them evenly;
            this is equivalent to power(1). A power value larger than 1 squishes the
            positions towards the lower bound. If interpolating between two colors,
            this means that the first color will dominate most of the interpolation
            range (slow to fast transition). A value between 0 and 1 squishes the
            positions towards the upper bound, thus making the second color the
            dominant color for most of the range (fast to slow transition). Another
            way to think of the effect of power() is that it moves the center of the
            color gradient up (if # > 1) or down (if 0 < # < 1).

            Example: colorpalette: #fafa6e #2a4858, ipolate(30, HCL power(1.5))
            name(slow) / #fafa6e #2a4858, ipolate(30, HCL power(0.7)) name(fast)

        positions(numlist) specifies the positions of the origin colors with respect
            to the interpolation range. The default is to arrange them on a regular
            grid from 0 and 1. If the number of specified positions is smaller than
            the number of origin colors, default positions are used for the remaining
            colors. If the same position is specified for multiple colors, these
            colors will be averaged before applying interpolation.

            Example: colorpalette: Black Crimson Gold, ipolate(30, position(0 .3 1))
            name(left) / Black Crimson Gold, ipolate(30, position(0 .7 1))
            name(right)

        padded requests padded interpolation. By default, the first color and the
            last color are taken as the end points of the interpolation range; these
            colors thus remain unchanged. Alternatively, if you specify option
            padded, the first and last colors will be interpreted as interval
            midpoints on an equally-spaced grid. This increases the interpolation
            range by half an interval on each side and causes the first color and the
            last color to be affected by the interpolation.

            Example (the difference is subtle, but the padded variant is a bit darker
            at the bottom and the top, which represents the original 11-color scale
            better than the unpadded variant):

                . colorpalette, span vertical: BrBG / BrBG, ipolate(30) name(ipolate)
                  / BrBG, ipolate(30, padded) name(padded ipolate)

        Circular interpolation will be used for palettes declared as cyclic or
        circular (see option class()). In this case, options range(), power(),
        positions(), and padded have no effect.

    intensify(numlist) modifies the intensity of the colors. The values in numlist
        must be between 0 and 255. Values below 1 make the colors lighter; values
        larger than 1 make the colors darker (although the allowed scale goes up to
        255, values as low as 5 or 10 may already make a color black). Specify
        multiple values to apply different adjustments across the colors. If the
        number of specified values is smaller than the number of colors, the values
        will be recycled; if the number of values is larger than the number of
        colors, the colors will be recycled. To skip adjusting the intensity of a
        particular color, you may set the corresponding element to . (missing).
        intensify() is applied after n(), select(), drop(), order(), reverse,
        shift(), opacity(), intensity(), and ipolate() have taken effect.

        intensify() applies the same kind of intensity adjustment as implemented by
        the intensity adjustment multipliers set by intensity().  The difference
        between intensify() and intensity() is that intensity() only records the
        intensity multipliers (which are then returned as part of the color
        definitions), whereas intensify() directly applies intensity adjustment by
        transforming the RGB values. A second difference is that intensity() is
        applied before interpolation, whereas intensify() is applied after
        interpolation.

        Example: colorpalette "189 30 36", intensify(0.1(.05)1) name(Reds)

    saturate(numlist[, cspace level]) modifies the saturation (colorfulness) of the
        colors. Positive numbers will increase the chroma channel of the colors by
        the specified amount, negative numbers will reduce chroma. Specify multiple
        values to apply different adjustments across the colors. If the number of
        values is smaller than the number of colors, the values will be recycled; if
        the number of values is larger than the number of colors, the colors will be
        recycled. To skip adjusting the saturation of a particular color, you may set
        the corresponding element to . (missing). saturate() is applied after n(),
        select(), drop(), order(), reverse, shift(), opacity(), intensity(),
        ipolate(), and intensify() have taken effect. Suboptions are as follows.

        cspace specifies the color space in which the colors are manipulated.
            Possible spaces are LCh (cylindrical representation of CIE L*a*b*), HCL
            (cylindrical representation of CIE L*u*v*), JCh (CIECAM02 JCh), and JMh
            (CIECAM02-based J'M'h). The default is LCh.

        level specifies that the provided numbers are levels, not differences. The
            default is to adjust the chroma values of the colors by
            adding/subtracting the specified amounts. Alternatively, if levels is
            specified, the chroma values of the colors will be set to the specified
            levels. Chroma values of typical colors lie between 0 and 100 or maybe
            150.

        Example: colorpalette: RdYlGn, saturate(25) name(+25) / RdYlGn / RdYlGn,
        saturate(-25) name(-25)

    luminate(numlist[, cspace level]) modifies the luminance (brightness) of the
        colors. Positive numbers will increase the luminance of the colors by the
        specified amount, negative numbers will reduce luminance. Specify multiple
        values to apply different adjustments across the colors. If the number of
        values is smaller than the number of colors, the values will be recycled; if
        the number of values is larger than the number of colors, the colors will be
        recycled. To skip adjusting the luminance of a particular color, you may set
        the corresponding element to . (missing). luminate() is applied after n(),
        select(), drop(), order(), reverse, shift(), opacity(), intensity(),
        ipolate(), intensify(), and saturate() have taken effect. Suboptions are as
        follows.

        cspace specifies the color space in which the colors are manipulated.
            Possible spaces are Lab (CIE L*a*b*), Luv (CIE L*u*v*), JCh (CIECAM02
            JCh), and JMh (CIECAM02-based J'M'h) (LCh, HCL, and Jab are also allowed,
            but result in the same colors as Lab, Luv, and JMh, respectively). The
            default is JMh.

        level specifies that the provided numbers are levels, not differences. The
            default is to adjust the luminance values of the colors by
            adding/subtracting the specified amounts. Alternatively, if levels is
            specified, the luminance values of the colors will be set to the
            specified levels. Luminance values of typical colors lie between 0 and
            100.

        Examples:

            . colorpalette: ptol, luminate(15) name(+15) / ptol / ptol, luminate(-15)
                name(-25)
            . colorpalette: blue red green, select(1 1 2 2 3 3) luminate(. 40)

    gscale[([numlist] [, cspace ])] converts the colors to gray, where numlist in
        [0,1] specifies the proportion of gray. The default is 1 (full conversion).
        Specify multiple values to apply different adjustments across the colors. If
        the number of values is smaller than the number of colors, the values will be
        recycled; if the number of values is larger than the number of colors, the
        colors will be recycled. To skip adjusting a particular color, you may set
        the corresponding element to . (missing). Suboption cspace specifies the
        color space in which the conversion is performed; it may be LCh (cylindrical
        representation of CIE L*a*b*), HCL (cylindrical representation of CIE
        L*u*v*), JCh (CIECAM02 JCh), and JMh (CIECAM02-based J'M'h). The default is
        LCh. Example:

            . colorpalette: s2 / s2, gscale(.5) name(50% gray) / s2, gscale name(100%
                gray)

        gscale() is applied after n(), select(), drop(), order(), reverse, shift(),
        opacity(), intensity(), ipolate(), intensify(), saturate(), and luminate()
        have taken effect.

    cblind[([numlist] [, type ])] simulates color vision deficiency, where numlist in
        [0,1] specifies the severity of the deficiency. The default is 1 (maximum
        severity, i.e. deuteranopia, protanopia, or tritanopia, respectively).
        Specify multiple values to apply different adjustments across the colors. If
        the number of values is smaller than the number of colors, the values will be
        recycled; if the number of values is larger than the number of colors, the
        colors will be recycled. To skip adjusting a particular color, you may set
        the corresponding element to . (missing). Suboption type specifies type of
        color vision deficiency, which may be deuteranomaly (the default),
        protanomaly, or tritanomaly. See Wikipedia for basic information on color
        blindness. Example:

            . colorpalette: Set1 / Set1, cblind(.5, deut) name(50% deut) / Set1,
                cblind(.5, prot) name(50% prot) / Set1, cblind(1, trit)
                name(tritanopia)

        cblind() is applied after n(), select(), drop(), order(), reverse, shift(),
        opacity(), intensity(), ipolate(), intensify(), saturate(), luminate(), and
        gscale() have taken effect.

    other are additional palette-specific options. See the descriptions of the
        palettes below. Palette-specific options have to be unique, that is, they can
        only be specified once per palette. When collecting results from multiple
        palettes, palette options can be specified at the global level, to define
        default settings for all palettes, or at the local level of an individual
        palette. For general palette options, defaults set at the global level can be
        overridden by repeating an option at the local level. Such repetitions are
        not allowed for palette-specific options.

    forcergb enforces translation of all colors to RGB. By default, colorpalette does
        not translate colors specified as Stata color names. Specify forcergb to
        return these colors as RGB values.

    noexpand omits recycling or interpolating colors if the number of requested
        colors is larger than the maximum number of colors defined in a palette.

    class(class) declares the class of the the palette, where class may be
        qualitative (or categorical), sequential, diverging, cyclic (or circular), or
        any other string. Palettes declared as qualitative or categoprical will be
        recycled, all other palettes will be interpolated (if recycling or
        interpolation is necessary). Specifying class() only affects palettes that do
        not set the class as part of their definition.

    name(str) assigns a custom name to the palette.

        +-------------------------------+
    ----+ Macro options (syntax 1 only) +--------------------------------------------

    globals[(spec)] stores the color codes as global macros (syntax 1 only). Use this
        option as an alternative to obtaining the color codes from r(); see the
        example below. The syntax of spec is

            [namelist] [stub*] [, prefix(prefix) suffix(suffix) nonames ]

        where namelist provides custom names for the colors and stub* provides a stub
        for automatic names. If no name is found for a color in the palette
        definition and no custom name is provided, an automatic name defined as
        stub#suffix will be used, where # is the number of the color in the palette.
        The default stub is p or as set by prefix(). Options are as follows:

        prefix() specifies a common prefix to be added to the names.

        suffix() specifies a common suffix to be added to the names.

        nonames prevents colorpalette from using the names found in the palette
            definition.

        Graph display will be disabled unless option graph is specified.

    locals[(spec)] stores the color codes as local macros (syntax 1 only). Syntax and
        functionality is as described for option globals(), with the exception that
        stub defaults to empty string. Graph display will be disabled unless option
        graph is specified.

    stylefiles[(spec)] stores the color codes in style files on disk (syntax 1 only).
        This makes the colors permanently available by their name, just like official
        Stata's color names; see the example below (you may need to flush graph's
        working memory using discard or clear all before the new colors become
        available). Style files will only be created for colors that are represented
        by a simple RGB code; codes that include an intensity-adjustment or opacity
        operator and colors that are referred to by their Stata name will be skipped.
        The syntax of spec is

            [namelist] [stub*] [, prefix(prefix) suffix(suffix) nonames personal
                path(path) replace ]

        where namelist provides custom names for the colors and stub* provides a stub
        for automatic names. If no name is found for a color in the palette
        definition and no custom name is provided, an automatic name defined as
        stub#suffix will be used, where # is the number of the color in the palette.
        The default stub is empty string or as set by prefix(). Options are as
        follows:

        prefix() specifies a common prefix to be added to the names.

        suffix() specifies a common suffix to be added to the names.

        nonames prevents colorpalette from using the names found in the palette
            definition.

        personal causes the style files to be stored in folder 'style' within the
            PERSONAL ado-file directory; see help sysdir. The default is to store the
            style files in folder 'style' within the current working directory; see
            help pwd.

        path(path) provides a custom path for the style files. The default is to
            store the style files in folder 'style' within the current working
            directory. path() and personal are not both allowed.

        replace permits colorpalette to overwrite existing files.

        Graph display will be disabled unless option graph is specified.

        +---------------+
    ----+ Graph options +------------------------------------------------------------

    title(string) specifies a custom title for the graph.

    nonumbers suppresses the numbers identifying the colors in the graph.

    gropts(twoway_options) provides options to be passed through to the graph
        command.

    rows(#) specifies the minimum number of rows in the graph (syntax 1 only). The
        default is 5.

    names replaces the RGB values in the graph by the information found in r(p#name)
        (i.e. the color names), if such information is available (syntax 1 only).

    noinfo suppresses the additional color information that is sometimes printed
        below the RGB values or color names.

    nograph suppresses the graph (syntax 1 only).

    graph enforces drawing a graph even though macro_options have been specified
        (syntax 1 only).

    horizontal displays the palettes horizontally (syntax 2 only). This is the
        default.

    vertical displays the palettes vertically (syntax 2 only).

    span adjusts the size of the color fields such that each palette spans the full
        plot region, irrespective of the number of colors (syntax 2 only).

    barwidth(#) sets the width of the color bars (syntax 2 only). The default is
        barwidth(0.7). The available space per bar is 1 unit; specifying barwidth(1)
        will remove the gap between bars.

    labels(strlist) provides custom labels for the palettes (syntax 2 only). Enclose
        labels with spaces in double quotes.

    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.

    lwidth(linewidthstyle) specifies a custom outline thickness (syntax 2 only). The
        default is lwidth(vthin).

        +--------------------+
    ----+ Colorcheck options +-------------------------------------------------------

    metric(metric) selects the color difference metric to be used. metric can be E76,
        E94, E2000, or Jab; see help colrspace for detail. Default is metric(Jab).

    mono([#] [, method]) determines the settings for grayscale conversion, where # in
        [0,1] specifies the proportion of gray (default is mono(1), i.e. full
        conversion) and method selects the conversion method (default is LCh, see see
        help colrspace for available methods).

    cvd(#), with # in [0,1], sets the severity of color vision deficiency. Default is
        cvd(1) (maximum severity).

    nograph suppresses the graph.

    sort[(spec)] sorts the colors in the graph, where spec may be normal (by hue of
        normal vision), mono (by shading of monochromacy vision), deuter (by hue of
        deuteranomaly vision), prot (by hue of protanomaly vision), or trit (by hue
        of tritanomaly vision). sort without argument is equivalent to sort(normal).
        Sort only has an effect on how the colors are ordered in the graph, but not
        on how the colors are stored in r().

    graph_options are graph options as for colorpalette (Syntax 2).


Palettes

        +-----------+
    ----+ colorlist +----------------------------------------------------------------

    Instead of selecting a named color palette you can specify a custom list of color
    specifications using syntax

        [(]colorspec [colorspec ...][)]

    where colorspec is

        ["]color[%#][*#]["]

    Parentheses around the list may be used to prevent name conflict with palette
    specifications. Color specifications containing spaces must be included in double
    quotes. Argument %# in colorspec sets the opacity (in percent; 0 = fully
    transparent, 100 = fully opaque; Stata 15 required), *# adjusts the intensity
    (values between 0 and 1 make the color lighter; values larger than one make the
    color darker), and color is one of the following:

        name               color name; this includes official Stata's color names as
                             listed in colorstyle, possible user additions provided
                             through style files, as well as a large collection of
                             named colors provided by colrspace
        #rrggbb            6-digit hex RGB value; white = #FFFFFF or #ffffff, navy =
                             #1A476F or #1a476f
        #rgb               3-digit abbreviated hex RGB value; white = #FFF or #fff
        # # #              RGB value in 0-255 scaling; navy = "26 71 111"
        # # # #            CMYK value in 0-255 or 0-1 scaling; navy = "85 40 0 144"
                             or ".333 .157 0 .565"
        cspace ...         color value in one of the color spaces supported by
                             colrspace; e.g., navy = "XYZ 5.55 5.87 15.9" or "Lab 29
                             -.4 -27.5" or "Jab 30.1 -8.9 -19" (see help colrspace
                             for more examples)

    Example: navy in 5 different ways

        . colorpalette navy "26 71 111" "85 40 0 144" "hsv 208 .766 .435" "hcl 246.6
            38.8 29"

    Example: hex colors (using colors from Bootstrap v3.3)

        . colorpalette #337ab7 #5cb85c #5bc0de #f0ad4e #d9534f

        For background information on hex colors see 
        en.wikipedia.org/wiki/Web_colors. Some websites providing collections of
        colors are www.w3schools.com/colors, htmlcolorcodes.com, or 
        www.color-hex.com).

    Example: specifying opacity and intensity adjustment

        . colorpalette "26 71 111%80" "26 71 111*.7" "26 71 111%80*.7"

    Example: named colors from colrspace

        . colorpalette slate paleviolet lightsea sandy

    Apart from Stata's system colors, the following named colors are supported:

    140 HTML colors:  AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, Beige,
        Bisque, Black, BlanchedAlmond, Blue, BlueViolet, Brown, BurlyWood, CadetBlue,
        Chartreuse, Chocolate, Coral, CornflowerBlue, Cornsilk, Crimson, Cyan,
        DarkBlue, DarkCyan, DarkGoldenRod, DarkGray, DarkGrey, DarkGreen, DarkKhaki,
        DarkMagenta, DarkOliveGreen, DarkOrange, DarkOrchid, DarkRed, DarkSalmon,
        DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkSlateGrey, DarkTurquoise,
        DarkViolet, DeepPink, DeepSkyBlue, DimGray, DimGrey, DodgerBlue, FireBrick,
        FloralWhite, ForestGreen, Fuchsia, Gainsboro, GhostWhite, Gold, GoldenRod,
        Gray, Grey, Green, GreenYellow, HoneyDew, HotPink, IndianRed, Indigo, Ivory,
        Khaki, Lavender, LavenderBlush, LawnGreen, LemonChiffon, LightBlue,
        LightCoral, LightCyan, LightGoldenRodYellow, LightGray, LightGrey,
        LightGreen, LightPink, LightSalmon, LightSeaGreen, LightSkyBlue,
        LightSlateGray, LightSlateGrey, LightSteelBlue, LightYellow, Lime, LimeGreen,
        Linen, Magenta, Maroon, MediumAquaMarine, MediumBlue, MediumOrchid,
        MediumPurple, MediumSeaGreen, MediumSlateBlue, MediumSpringGreen,
        MediumTurquoise, MediumVioletRed, MidnightBlue, MintCream, MistyRose,
        Moccasin, NavajoWhite, Navy, OldLace, Olive, OliveDrab, Orange, OrangeRed,
        Orchid, PaleGoldenRod, PaleGreen, PaleTurquoise, PaleVioletRed, PapayaWhip,
        PeachPuff, Peru, Pink, Plum, PowderBlue, Purple, RebeccaPurple, Red,
        RosyBrown, RoyalBlue, SaddleBrown, Salmon, SandyBrown, SeaGreen, SeaShell,
        Sienna, Silver, SkyBlue, SlateBlue, SlateGray, SlateGrey, Snow, SpringGreen,
        SteelBlue, Tan, Teal, Thistle, Tomato, Turquoise, Violet, Wheat, White,
        WhiteSmoke, Yellow, YellowGreen

    30 W3.CSS default colors:  w3-red, w3-pink, w3-purple, w3-deep-purple, w3-indigo,
        w3-blue, w3-light-blue, w3-cyan, w3-aqua, w3-teal, w3-green, w3-light-green,
        w3-lime, w3-sand, w3-khaki, w3-yellow, w3-amber, w3-orange, w3-deep-orange,
        w3-blue-grey, w3-brown, w3-light-grey, w3-grey, w3-dark-grey, w3-black,
        w3-white, w3-pale-red, w3-pale-yellow, w3-pale-green, w3-pale-blue

    Further color collections from W3.CSS (using names as provided by W3.CSS, e.g.
        w3-flat-turquoise):  Flat UI Colors, Metro UI Colors, Windows 8 Colors, iOS
        Colors, US Highway Colors, US Safety Colors, European Signal Colors, Fashion
        Colors 2019, Fashion Colors 2018, Fashion Colors 2017, Vivid Colors, Food
        Colors, Camouflage Colors, ANA (Army Navy Aero) Colors, and Traffic Colors.

    The color names can be abbreviated and typed in lowercase letters. If
    abbreviation is ambiguous, the first matching name in the alphabetically ordered
    list will be used. In case of name conflict with a Stata color, the color from 
    colrspace will take precedence only if the specified name is an exact match
    including case. For example, pink will refer to official Stata's pink, whereas
    Pink will refer to HTML color pink.

        +----+
    ----+ s2 +-----------------------------------------------------------------------

    Palette s2 (view) contains the 15 colors used for p1 to p15 in Stata's s2color
    scheme. s2 is the default palette.

        +----+
    ----+ s1 +-----------------------------------------------------------------------

    Palette s1 (view) contains the colors used for p1 to p15 in Stata's s1color
    scheme.

        +-----+
    ----+ s1r +----------------------------------------------------------------------

    Palette s1r (view) contains the colors used for p1 to p15 in Stata's s1rcolor
    scheme.

        +-----------+
    ----+ economist +----------------------------------------------------------------

    Palette economist (view) contains the colors used for p1 to p15 in Stata's
    economist scheme.

        +------+
    ----+ mono +---------------------------------------------------------------------

    Palette mono (view) contains the gray scales used for p1 to p15 in Stata's
    monochrome schemes (s2mono, s1mono).

        +------------------+
    ----+ okabe and cblind +---------------------------------------------------------

    The okabe palette (view) contains colorblind-friendly colors suggested by Okabe
    and Ito (2002). The cblind palette (view) additionally includes gray as suggested
    at www.cookbook-r.com.  The same colors are also used (in different order and
    using gs10 for gray) in the plotplainblind and plottigblind schemes by Bischof
    (2017b). Type colorpalette cblind, select(1 2 4 5 9 8 7 3 6) for a palette
    equivalent to the one used in plotplainblind, and colorpalette okabe, select(1 3
    4 8 7 6 2 5) for plottigblind.

        +---------+
    ----+ plottig +------------------------------------------------------------------

    Palette plottig (view) contains the colors used for p1 to p15 in the plottig
    scheme by Bischof (2017b). Most of these colors are the same as the colors
    produced by the hue color generator with default options (view), although in
    different order.

        +-----+
    ----+ 538 +----------------------------------------------------------------------

    Palette 538 (view) contains the colors used for p1 to p6, background, labels,
    axes etc., and CIs in the 538 scheme by Bischof (2017a). The palette replicates
    colors used at fivethirtyeight.com.

        +-----+
    ----+ mrc +----------------------------------------------------------------------

    Palette mrc (view) contains the colors used for p1 to p7 in the mrc scheme by
    Morris (2013). These are colors according to guidelines by the UK Medical
    Research Council.

        +-----+
    ----+ tfl +----------------------------------------------------------------------

    Palette tfl (view) contains the colors used for p1 to p8 in the tfl scheme by
    Morris (2015). The palette replicates Transport for London's corporate colors.

        +------+
    ----+ burd +---------------------------------------------------------------------

    Palette burd (view) contains the colors used for p1 to p9 and for CIs in the burd
    scheme by Briatte (2013). The p1 to p9 colors are a selection of colors from
    various ColorBrewer schemes.

        +------+
    ----+ lean +---------------------------------------------------------------------

    Palette lean (view) contains gray scales used for p1area to p15area in schemes
    lean1 and lean2 by Juul (2003).

        +---------+
    ----+ tableau +------------------------------------------------------------------

    The tableau (view) contains 20 categorical colors provided by Lin et al. (2013).
    The hex values of the colors have been taken from code provided by the authors at
    GitHub. The same colors are also used in d3.

        +-----+
    ----+ hue +----------------------------------------------------------------------

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

    Syntax:

        hue [, hue(start end) chroma(#) luminance(#) direction(#) palette_options ]

    Options:

    hue(start end) sets the range of hues on the 360 degree color wheel. The default
        is hue(15 375). If the difference between start and end is a multiple of 360,
        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).

    chroma(#) sets the colorfulness (color intensity), with # >= 0. The default is
        chroma(100).

    luminance(#) sets the brightness (amount of gray), with # in [0, 100]. The
        default is luminance(65).

    direction(#) determines the direction to travel around the color wheel.
        direction(1), the default, travels clockwise; direction(-1) travels
        counter-clockwise.

    Examples:

        . colorpalette, span: hue, n(3) name(3) / hue, n(5) name(5) / hue, n(7)
            name(7) / hue, n(9) name(9)
        . colorpalette hue, n(5) hue(90 -30) chroma(50) luminance(70)

        +-------------+
    ----+ HCL/LCh/JMh +--------------------------------------------------------------

    The HCL, LCh, and JMh palettes are color generators in the HCL
    (Hue-Chroma-Luminance) space (cylindrical representation of CIE L*u*v*), the LCh
    space (cylindrical representation of CIE L*a*b*), and the CIECAM02-based J'M'h
    space, respectively. The HCL implementation is based on R's colorspace package by
    Ihaka et al. (2016); also see Zeileis et al. (2009) and hclwizard.org. The LCh
    and JMh generators are implemented analogously.

    Let h1 and h2 be two hues on the 360 degree color wheel, c1 and c2 two chroma
    levels (M' in case of JMh), l1 and l2 two luminance levels (J' in case of JMh),
    p1 and p2 two power parameters, and i an index from 1 to n, where n is the number
    of requested colors. The 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)

    Syntax:

        {HCL|LCh|JMh} [scheme] [, hue(h1 [h2]) chroma(c1 [c2]) luminance(l1 [l2])
               power(p1 [p2]) palette_options ]

    where scheme picks the type of color formula (qualitative, sequential, or
    diverging) and sets the default parameter values. scheme can be one of following
    (qualitative is the default; abbreviations are allowed).

        Qualitative (view: HCL, LCh, JMh)
                            h1              h2   c1   l1
        qualitative         15  h1+360*(n-1)/n   60   70
        intense             15  h1+360*(n-1)/n  100   65
        dark                15  h1+360*(n-1)/n   80   60
        light               15  h1+360*(n-1)/n   50   80
        pastel              15  h1+360*(n-1)/n   35   85

        Sequential (view: HCL, LCh, JMh)
                            h1   h2   c1   c2   l1   l2   p1   p2
        sequential         260   h1   80   10   25   95    1   p1
        blues              260   h1   80   10   25   95    1   p1
        greens             145  125   80   10   25   95    1   p1
        grays                0   h1    0    0   15   95    1   p1
        oranges             40   h1  100   10   50   95    1   p1
        purples            280   h1   70   10   20   95    1   p1
        reds                10   20   80   10   25   95    1   p1
        heat                 0   90  100   30   50   90  0.2  1.0
        heat2                0   90   80   30   30   90  0.2  2.0
        terrain            130    0   80    0   60   95  0.1  1.0
        terrain2           130   30   65    0   45   90  0.5  1.5
        viridis            300   75   35   95   15   90  0.8  1.2
        plasma             100   h1   60  100   15   95  2.0  0.9
        redblue              0 -100   80   40   40   75  1.0  1.0

        Diverging (view: HCL, LCh, JMh)
                            h1   h2   c1   l1   l2   p1   p2
        diverging          260    0   80   30   95    1   p1
        bluered            260    0   80   30   95    1   p1
        bluered2           260    0  100   50   95    1   p1
        bluered3           180  330   60   75   95    1   p1
        greenorange        130   45  100   70   95    1   p1
        browngreen          55  160   60   35   95    1   p1
        pinkgreen          340  128   90   35   95    1   p1
        purplegreen        300  128   60   30   95    1   p1

    The shown parameter values are for HCL; LCh and JMh use adjusted values such that
    the end points of the generated colors are similar to the ones generated by HCL
    (see source file colrspace_library_generators.sthlp). Options are:

    hue(h1 [h2]) overrides the default values for h1 and h2. h1 and h2 are hues on
        the 360 degree color wheel.

    chroma(c1 [c2]) overrides the default values for c1 and c2, with c# >= 0. c1 and
        c2 determine the colorfulness (color intensity).

    luminance(l1 [l2]) overrides the default values for l1 and l2, with l# in [0,
        100]. l1 and l2 determine the brightness.

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

        +---------+
    ----+ HSV/HSL +------------------------------------------------------------------

    The HSV and HSL palettes are color generators in the HSV (Hue-Saturation-Value)
    and HSL (Hue-Saturation-Lightness) spaces. The implementation is partially based
    on R's grDevices package (which is part of the R core) and partially on
    colorspace by Ihaka et al. (2016). Used formulas are analogous to the formulas of
    the HCL generator.

    Syntax:

        {HSV|HSL} [scheme] [, hue(h1 [h2]) saturation(s1 [s2]) value(v1 [v2])
               power(p1 [p2]) palette_options ]

    where scheme picks the type of color formula (qualitative, sequential, or
    diverging) and sets the default parameter values. scheme can be one of following
    (qualitative is the default; abbreviations are allowed).

    For HSV, scheme can be one of the following.

        Qualitative (view):  qualitative, intense, dark, light, pastel, rainbow
        Sequential (view):   sequential, blues, greens, grays, oranges, purples, 
                             reds, heat, terrain, heat0, terrain0
        Diverging (view):    diverging, bluered, bluered2, bluered3, greenorange,
                             browngreen, pinkgreen, purplegreen

    For HSL, scheme can be: qualitative, sequential, or diverging

    Options are:

    hue(h1 [h2]) overrides the default values for h1 and h2. h1 and h2 are hues on
        the 360 degree color wheel.

    saturation(c1 [c2]) overrides the default values for c1 and c2, with c# in [0,
        1]. c1 and c2 determine the colorfulness (color intensity).

    value(l1 [l2]) overrides the default values for l1 and l2, with l# in [0, 1]. l1
        and l2 determine the brightness.

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

    See source file colrspace_library_generators.sthlp for default parameter values
    of the above schemes.

        +------+
    ----+ pals +---------------------------------------------------------------------

    The pals collection provides some categorical color schemes that have been
    obtained from the pals package in R; see github.com/kwstat/pals. The syntax is

        scheme [, palette_options ]

    where scheme is one of the following (abbreviations allowed) (view).

        alphabet       26 colors
        alphabet2      26 colors
        cols25         25 colors
        glasbey        32 colors
        kelly          22 colors
        polychrome     36 colors
        watlington     16 colors

        +----+
    ----+ d3 +-----------------------------------------------------------------------

    The d3 collection provides categorical color schemes from D3.js, using the color
    values found at github.com/d3. The syntax is

        d3 [scheme] [, palette_options ]

    where scheme is one of the following (view).

        10     10 categorical colors; the default; same as first 10 colors in tableau
        20     20 categorical colors in pairs; same colors as in tableau, but ordered
                 differently
        20b    20 categorical colors in groups of four
        20c    20 categorical colors in groups of four

    These colors appear to be colors that have been used in earlier versions of
    Tableau. The four palettes are thus also available as tab10, tab20, tab20b, and
    tab20c.

        +----+
    ----+ sb +-----------------------------------------------------------------------

    The sb collection provides categorical color schemes from seaborn.pydata.org
    (same basic colors as tab10, but in different tones). The syntax is

        sb [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations allowed).

        10 colors (view)      6 colors (view)
        ------------------    --------------------------------------
        deep (default)        deep6 (also available as palette sb6)
        muted                 muted6
        pastel                pastel6
        bright                bright6
        dark                  dark6
        colorblind            colorblind6

        +-----+
    ----+ tab +----------------------------------------------------------------------

    The tab collection provides various color schemes from Tableau 10 (the color
    values have been obtained from the ggthemes package in R). The syntax is

        tab [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations and lower case spelling
    allowed).

        Qualitative           (view 1-8) (view 9-15)
        10                    10 colors; the default
        20                    10 colors
        Color Blind           10 colors
        Seattle Grays         5 colors
        Traffic               9 colors
        Miller Stone          11 colors
        Superfishel Stone     10 colors
        Nuriel Stone          9 colors
        Jewel Bright          9 colors
        Summer                8 colors
        Winter                10 colors
        Green-Orange-Teal     12 colors
        Red-Blue-Brown        12 colors
        Purple-Pink-Gray      12 colors
        Hue Circle            19 colors

        Sequential            (view 1-8) (view 9-15)
        Blue-Green            7 colors
        Blue Light            7 colors
        Orange Light          7 colors
        Blue                  20 colors
        Orange                20 colors
        Green                 20 colors
        Red                   20 colors
        Purple                20 colors
        Brown                 20 colors
        Gray                  20 colors
        Gray Warm             20 colors
        Blue-Teal             20 colors
        Orange-Gold           20 colors
        Green-Gold            20 colors
        Red-Gold              21 colors

        Diverging             (view 1-8) (view 9-15)
        Orange-Blue           7 colors
        Red-Green             7 colors
        Green-Blue            7 colors
        Red-Blue              7 colors
        Red-Black             7 colors
        Gold-Purple           7 colors
        Red-Green-Gold        7 colors
        Sunset-Sunrise        7 colors
        Orange-Blue-White     7 colors
        Red-Green-White       7 colors
        Green-Blue-White      7 colors
        Red-Blue-White        7 colors
        Red-Black-White       7 colors
        Orange-Blue Light     7 colors
        Temperature           7 colors

        +-----+
    ----+ tol +----------------------------------------------------------------------

    The tol collection provides various color schemes presented by Paul Tol at
    personal.sron.nl/~pault. The syntax is

        tol [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations and lower case spelling
    allowed).

        Qualitative (view)   
        bright                8 colors
        high-contrast         4 colors
        vibrant               8 colors
        muted                 11 colors; the default
        medium-contrast       7 colors
        light                 10 colors

        Sequential (view)    
        YlOrBr                9 colors
        iridescent            23 colors

        Rainbow (view)       
        rainbow               1-23 colors
        PuRd                  22 colors
        PuBr                  26 colors
        WhRd                  30 colors
        WhBr                  34 colors

        Diverging (view)     
        sunset                11 colors
        BuRd                  9 colors
        PRGn                  9 colors

    The definitions of the schemes have been obtained from source file tol_colors.py.
    These definitions may deviate from how the palettes are presented at
    personal.sron.nl/~pault (e.g., with respect to the order of colors in the
    qualitative schemes).

        +------+
    ----+ ptol +---------------------------------------------------------------------

    The ptol collection provides color schemes suggested by Tol (2012). The syntax is

        ptol [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations allowed) (view).

        qualitative    1-12 qualitative colors; the default
        rainbow        4-12 rainbow colors
        diverging      3-11 diverging colors; very similar to reverse RdYlBu

        +-------------+
    ----+ ColorBrewer +--------------------------------------------------------------

    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 ColorBrewer_updates.html. For more information on ColorBrewer
    also see http://colorbrewer2.org/. The RGB values for the implementation of the
    colors in colorpalette have been taken from the Excel spreadsheet provided at
    ColorBrewer_RGB.html.  The CMYK values have been taken from file cb.csv provided
    at GitHub. ColorBrewer palettes for Stata are also provided by Gomez (2015) and
    by Buchanan (2015).

    The syntax for the ColorBrewer palettes is

        scheme [cmyk] [, palette_options ]

    where scheme is one of the following (abbreviations and lower case spelling
    allowed)

        Qualitative (view)
        Accent       8 accented colors for qualitative data
        Dark2        8 dark colors for qualitative data
        Paired       12 paired colors for qualitative data
        Pastel1      9 pastel colors for qualitative data
        Pastel2      8 pastel colors for qualitative data
        Set1         9 colors for qualitative data
        Set2         8 colors for qualitative data
        Set3         12 colors for qualitative data

        Sequential (single hue) (view)
        Blues        light blue to blue (3-9 colors)
        Greens       light green to green (3-9 colors)
        Greys        light gray to gray (3-9 colors)
        Oranges      light orange to orange (3-9 colors)
        Purples      light purple to purple (3-9 colors)
        Reds         light red to red (3-9 colors)

        Sequential (multi-hue) (view)
        BuGn         light blue to green (3-9 colors)
        BuPu         light blue to purple (3-9 colors)
        GnBu         light green to blue (3-9 colors)
        OrRd         light orange to red (3-9 colors)
        PuBu         light purple to blue (3-9 colors)
        PuBuGn       light purple over blue to green (3-9 colors)
        PuRd         light purple to red (3-9 colors)
        RdPu         light red to purple (3-9 colors)
        YlGn         light yellow to green (3-9 colors)
        YlGnBu       light yellow over green to blue (3-9 colors)
        YlOrBr       light yellow over orange to brown (3-9 colors)
        YlOrRd       light yellow over orange to red (3-9 colors)

        Diverging (view)
        BrBG         brown to green, light gray mid (3-11 colors)
        PiYG         pink to green, light gray mid (3-11 colors)
        PRGn         purple to green, light gray mid (3-11 colors)
        PuOr         orange to purple, light gray mid (3-11 colors)
        RdBu         red to blue, light gray mid (3-11 colors)
        RdGy         red to gray, white mid (3-11 colors)
        RdYlBu       red to blue, yellow mid (3-11 colors)
        RdYlGn       red to green, yellow mid (3-11 colors)
        Spectral     red - orange - yellow - green - blue (3-11 colors)

    and argument cmyk requests the CMYK variant of the scheme. The default is to use
        the RGB variant.

        +-------+
    ----+ carto +--------------------------------------------------------------------

    The carto collection provides various color schemes from Carto. The syntax is

        carto [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations and lower case spelling
    allowed).

        Qualitative (2-11 colors, plus one color for missing data) (view)
        Antique, Bold (the default), Pastel, Prism, Safe (colorblind-friendly), Vivid

        Sequential (2-7 colors) (view 1-11) (view 12-21)
        Burg, BurgYl, RedOr, OrYel, Peach, PinkYl, Mint, BluGrn, DarkMint, Emrld,
        ag_GrnYl, BluYl, Teal, TealGrn, Purp, PurpOr, Sunset, Magenta, SunsetDark,
        ag_Sunset, BrwnYl

        Diverging (2-7 colors) (view)
        ArmyRose, Fall, Geyser, Temps, TealRose, Tropic, Earth

        +---------+
    ----+ viridis +------------------------------------------------------------------

    The viridis collection provides perceptually uniform colormaps from matplotlib
    (also see bids.github.io/colormap). The color values have been taken from file
    _cm_listed.py at GitHub.

    The syntax for the viridis palettes is

        scheme [, range(lb [ub]) palette_options ]

    where scheme is one of the following (abbreviations allowed) (view)

        viridis           blue - green - yellow (sequential)
        plasma            blue - red - yellow (sequential)
        inferno           black - blue - orange - yellow (sequential)
        magma             black - blue - red - yellow (sequential)
        cividis           blue - olive - yellow (sequential, colorblind-friendly)
        twilight          blue - russet (cyclic)
        twilight shifted  blue - russet (cyclic)

    and option range(lb [ub]) selects the range of the colormap to be used, where lb
    and ub must be in [0,1]. The default is range(0 1). If lb is larger than ub, the
    colors are returned in reverse order. range() has not effect for cyclic
    colormaps.

        +---------+
    ----+ seaborn +------------------------------------------------------------------

    The seaborn collection provides perceptually uniform colormaps from
    seaborn.pydata.org.  The syntax is

        scheme [, range(lb [ub]) palette_options ]

    where scheme is one of the following (abbreviations allowed) (view)

        rocket       sequential
        mako         sequential
        flare        sequential
        crest        sequential
        vlag         diverging
        icefire      diverging

    and option range(lb [ub]) selects the range of the colormap to be used, where lb
    and ub must be in [0,1]. The default is range(0 1). If lb is larger than ub, the
    colors are returned in reverse order.

        +------------+
    ----+ matplotlib +---------------------------------------------------------------

    The matplotlib collection provides several colormaps from matplotlib (Hunter
    2007). The definitions of the colormaps have been taken from file _cm.py at
    GitHub.

    The syntax for the matplotlib collection is

        matplotlib [scheme] [, range(lb [ub]) palette_options ]

    where scheme is one of the following (abbreviations allowed) (view)

        jet          blue - green - yellow - red; the default
        autumn       red - yellow
        spring       magenta - yellow
        summer       green - yellow
        winter       blue - lime
        bone         black - bluish gray - white
        cool         cyan - magenta
        copper       black - orange/brown
        coolwarm     blue - red (diverging)
        hot          heat colors
        turbo        similar to jet

    and option range(lb [ub]) selects the range of the colormap to be used, where lb
    and ub must be in [0,1]. The default is range(0 1). If lb is larger than ub, the
    colors are returned in reverse order.

        +-----+
    ----+ CET +----------------------------------------------------------------------

    The CET collection provides perceptually uniform colormaps by Kovesi (2015). The
    syntax is

        CET scheme [, range(lb [ub]) palette_options ]

    where scheme is one of the following (abbreviations and lower case spelling
    allowed) (see colorcet.com/gallery.html for an overview)

        Linear:               L01, L02, L03, L04, L05, L06, L07, L08, L09, L10, L11,
                              L12, L13, L14, L15, L16, L17, L18, L19, L20 (default)
        Rainbow:              R1, R2, R3, R4
        Isoluminant:          I1, I2, I3
        Diverging:            D01, D01A, D02, D03, D04, D06, D07, D08, D09, D10, D11,
                              D12, D13
        Circular:             C1, C2, C3, C4, C5, C6, C7
        Colorblind-friendly:  CBD1, CBL1, CBL2, CBC1, CBC2

    and option range(lb [ub]) selects the range of the colormap to be used, where lb
    and ub must be in [0,1]. The default is range(0 1). If lb is larger than ub, the
    colors are returned in reverse order. range() has not effect for circular
    colormaps.

        +-------+
    ----+ scico +--------------------------------------------------------------------

    The scico collection provides perceptually uniform colorblind-friendly colormaps
    by Crameri (2018). The syntax is

        scico scheme [, range(lb [ub]) palette_options ]

    where scheme is one of the following (lower case spelling allowed) (see
    readme_scientificcolourmaps.pdf for an overview)

        Sequential:   batlow (default), batlowW, batlowK, devon, lajolla, bamako,
                      davos, bilbao, nuuk, oslo, grayC, hawaii, lapaz, tokyo, buda,
                      acton, turku, imola
        Diverging:    broc, cork, vik, lisbon, tofino, berlin, roma, bam, vanimo
        Cyclic:       romaO, bamO, brocO, corkO, vikO

    and option range(lb [ub]) selects the range of the colormap to be used, where lb
    and ub must be in [0,1]. The default is range(0 1). If lb is larger than ub, the
    colors are returned in reverse order. range() has not effect for cyclic
    colormaps.

        +-----+
    ----+ lin +----------------------------------------------------------------------

    The lin collection provides semantic color schemes suggested by Lin et al.
    (2013). The values of the colors have been taken from the source code of the
    brewscheme package by Buchanan (2015) (brewextra.ado, version 1.0.0, 21 March
    2016).

    The syntax is

        lin [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations allowed):

        carcolor              6 car colors (selected by Turkers)
        carcolor algorithm    6 car colors (algorithm selected)
        food                  7 food colors (selected by Turkers)
        food algorithm        7 food colors (algorithm selected)
        features              5 feature colors (selected by Turkers)
        features algorithm    5 feature colors (algorithm selected)
        activities            5 activity colors (selected by Turkers)
        activities algorithm  5 activity colors (algorithm selected)
        fruits                7 fruit colors; the default (selected by expert)
        fruits algorithm      7 fruit colors; the default (algorithm selected)
        vegetables            7 vegetable colors (selected by expert)
        vegetables algorithm  7 vegetable colors (algorithm selected)
        drinks                7 drinks colors (selected by expert)
        drinks algorithm      7 drinks colors (algorithm selected)
        brands                7 brands colors (selected by expert)
        brands algorithm      7 brands colors (algorithm selected)

        +-------+
    ----+ spmap +--------------------------------------------------------------------

    The spmap collection provides color schemes from the spmap package by Pisati
    (2007). The implementation is based on code from spmap_color.ado (version 1.3.0,
    13 March 2017).

    The syntax is

        spmap [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations allowed) (view):

        blues          light blue to blue (2-99 colors); the default
        greens         light green to green (2-99 colors)
        greys          light gray to black (2-99 colors)
        reds           light red to red (2-99 colors)
        rainbow        2-99 rainbow colors
        heat           2-16 heat colors
        terrain        2-16 terrain colors
        topological    2-16 topological colors

        +------+
    ----+ sfso +---------------------------------------------------------------------

    The sfso collection provides color schemes by the Swiss Federal Statistical
    Office (using hex and CMYK codes found in Bundesamt für Statistik 2017). The
    syntax is

        sfso [scheme] [cmyk] [, palette_options ]

    where scheme is one of the following (abbreviations allowed)

        Sequential (view)
        brown          dark brown to light brown (6 colors)
        orange         dark orange to light orange (6 colors)
        red            dark red to light red (6 colors)
        pink           dark pink to light pink (6 colors)
        purple         dark purple to light purple (6 colors)
        violet         dark violet to light violet (6 colors)
        blue           dark blue to light blue (7 colors); the default
        ltblue         lighter version of blue (6 colors)
        turquoise      dark turquoise to light turquoise (6 colors)
        green          dark green to light green (6 colors)
        olive          dark olive to light olive (6 colors)
        black          dark gray to light gray (6 colors)

        Semantic (view)
        parties        colors used by the SFSO for Swiss parties (11 colors)
        languages      colors used by the SFSO for languages (5 colors)
        votes          colors used by the SFSO for results from votes (10 colors)

    and argument cmyk requests the CMYK variant of the scheme. The default is to use
        the RGB variant.

        +------+
    ----+ HTML +---------------------------------------------------------------------

    The HTML collection provides named HTML colors from www.w3schools.com. The syntax
    is

        HTML [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations allowed).

        pink           6 pink colors
        purple         19 purple colors
        red            14 red and orange colors
        orange         14 red and orange colors
        yellow         11 yellow colors
        green          22 green colors
        cyan           8 cyan colors
        blue           16 blue colors
        brown          18 brown colors
        white          17 white colors
        gray           10 gray colors
        grey           10 grey colors (same color codes as gray)

    All 148 HTML colors (alphabetically sorted) will be returned if scheme is
    omitted.

        +----+
    ----+ w3 +-----------------------------------------------------------------------

    The w3 collection provides colors from W3.CSS. The syntax is

        w3 [scheme] [, palette_options ]

    where scheme is one of the following (abbreviations allowed).

        default        30 Default Colors; the default
        flat           20 Flat UI Colors
        metro          17 Metro UI Colors
        win8           22 Windows 8 Colors
        ios            12 iOS Colors
        highway        7 US Highway Colors
        safety         6 US Safety Colors
        signal         10 European Signal Colors
        2019           32 Fashion Colors 2019
        2018           30 Fashion Colors 2018
        2017           20 Fashion Colors 2017
        vivid          21 Vivid Colors
        food           40 Food Colors
        camo           15 Camouflage Colors
        ana            44 Army Navy Aero Colors
        traffic        9 Traffic Colors
        amber          11 sequential Amber colors
        black          11 sequential Black colors
        blue           11 sequential Blue colors
        blue-grey      11 sequential Blue Grey colors
        brown          11 sequential Brown colors
        cyan           11 sequential Cyan colors
        dark-grey      11 sequential Dark Grey colors
        deep-orange    11 sequential Deep Orange colors
        deep-purple    11 sequential Deep Purple colors
        green          11 sequential Green colors
        grey           11 sequential Grey colors
        indigo         11 sequential Indigo colors
        khaki          11 sequential Khaki colors
        light-blue     11 sequential Light Blue colors
        light-green    11 sequential Light Green colors
        lime           11 sequential Lime colors
        orange         11 sequential Orange colors
        pink           11 sequential Pink colors
        purple         11 sequential Purple colors
        red            11 sequential Red colors
        teal           11 sequential Teal colors
        yellow         11 sequential Yellow colors

        +-------------+
    ----+ wesanderson +--------------------------------------------------------------

    The wesanderson collection provides Wes Anderson palettes from
    wesandersonpalettes.tumblr.com (the color codes have been obtained from
    github.com/karthik/wesanderson). The syntax is

        scheme [, palette_options ]

    where scheme is one of the following (abbreviations and lower case spelling
    allowed).

                          (view 1-10) (view 11-19)
        BottleRocket1     7 qualitative colors from Bottle Rocket
        BottleRocket2     5 qualitative colors from Bottle Rocket
        Rushmore1         5 qualitative colors from Rushmore
        Royal1            4 qualitative colors from The Royal Tenenbaums
        Royal2            5 qualitative colors from The Royal Tenenbaums
        Zissou1           5 diverging colors from The Life Aquatic with Steve Zissou
        Darjeeling1       5 qualitative colors from The Darjeeling Limited
        Darjeeling2       5 qualitative colors from The Darjeeling Limited
        Chevalier1        4 qualitative colors from Hotel Chevalier
        FantasticFox1     5 qualitative colors from Fantastic Mr. Fox
        Moonrise1         4 qualitative colors from Moonrise Kingdom
        Moonrise2         4 qualitative colors from Moonrise Kingdom
        Moonrise3         5 qualitative colors from Moonrise Kingdom
        Cavalcanti1       5 qualitative colors from Castello Cavalcanti
        GrandBudapest1    4 qualitative colors from The Grand Budapest Hotel
        GrandBudapest2    4 qualitative colors from The Grand Budapest Hotel
        IsleofDogs1       6 qualitative colors from The Isle of Dogs
        IsleofDogs2       5 qualitative colors from The Isle of Dogs
        FrenchDispatch1   5 qualitative colors from The French Dispatch

        +--------+
    ----+ myname +-------------------------------------------------------------------

    A personal named palette can be provided in form of a program called
    colorpalette_myname, where myname is the name of the palette. Palette myname will
    then be available to colorpalette like any other palette. Your program should
    behave as follows.

        (1) It must return the color definitions as a comma-separated list in local
            macro P. All types of color specifications supported by colorpalette,
            including opacity and intensity operators, are allowed for the individual
            colors in the list.

        (2) If input is parsed using syntax, option n() must be allowed. In addition
            to n(), all options not consumed by colorpalette will be passed through
            to colorpalette_myname. This makes it possible to support custom options
            in your program.

        (3) Color names can be returned as a comma-separated list in local macro N.

        (4) Color descriptions can be returned as a comma-separated list in local
            macro I.

        (5) The palette name can be returned in local macro name (myname is used as
            the palette name if no name is returned).

        (6) The palette class can be returned in local macro class.

        (7) A palette description can be returned in local macro note.

        (8) Information on the source of the palette can be returned in local macro
            source.

    For example, the following program provides a palette called bootstrap3
    containing semantic colors used for buttons in Bootstrap 3.3:

        program colorpalette_bootstrap3
            syntax [, n(str) ] // n() not used
            c_local P #ffffff,#337ab7,#5cb85c,#5bc0de,#f0ad4e,#d9534f,/*
                    */#e6e6e6,#286090,#449d44,#31b0d5,#ec971f,#c9302c
            c_local N default,primary,success,info,warning,danger,/*
                */default.focus,primary.focus,success.focus,info.focus,/*
                */warning.focus,danger.focus
            c_local class qualitative
            c_local note Button colors from Bootstrap 3.3
            c_local source https://getbootstrap.com/docs/3.3/
        end

    After defining the program, you can, for example, type

        . colorpalette bootstrap3, rows(6)

    To make the new palette permanently available, store the program in file
    colorpalette_myname.ado in the working directory or somewhere along Stata’s ado
    path (see sysdir).

        +-----------------------+
    ----+ Mata ColrSpace object +----------------------------------------------------

    colorpalette can retrieve colors from a Mata ColrSpace object. The syntax is

        mata(name) [, palette_options ]

    where name is the name the object. Example:

        . mata: C1 = C2 = ColrSpace()
        . mata: C1.palette("s2", 5)
        . mata: C1.name("original colors")
        . mata: C2.set(C1.get("Lab") :* (1.2, 1, 1), "Lab")
        . mata: C2.name("luminance * 1.2")
        . colorpalette: mata(C1) / mata(C2)
        . colorpalette mata(C2), cblind(0.5) title(50% deuteranomaly)


Examples

        +----------------------------+
    ----+ Retrieving colors from r() +-----------------------------------------------

    Apart from viewing color palettes, colorpalette is useful for retrieving colors
    that can then be passed through to a graph command. The color codes are stored in
    r(). Here is an example of a contour plot using the terrain scheme from the hcl
    color generator:

        . sysuse sandstone, clear
        . colorpalette jmh terrain, n(10) nograph
        . twoway contour depth northing easting, levels(`r(n)') ccolors(`r(p)')

        +------------------------------------------+
    ----+ Making colors available as global macros +---------------------------------

    To make colors available as global macros, use the globals() option. For example,
    to make all HTML colors available, type:

        . colorpalette HTML, globals

    You can then use the created globals in subsequent graph commands:

        . sysuse auto, clear
        . scatter price weight, mc($Fuchsia) graphr(color($HoneyDew))
        . scatter price weight, mc($Tomato) graphr(color($SeaShell))

    The globals will disappear once you restart Stata.

        +-----------------------------------------+
    ----+ Making colors available as local macros +----------------------------------

    Depending on context (e.g., within a do-file or program), it may be convenient to
    make colors available as local macros; see the locals() option. Example:

        . colorpalette Accent, locals
        . sysuse auto, clear
        . scatter trunk turn mpg weight, mc(`1' `2' `3')

    The locals will disappear once the do-file or program concludes.

        +-------------------------------------------------------+
    ----+ Making colors permanently available using style files +--------------------

    To make new colors available permanently, use the stylefiles() option. This will
    cause RGB color definitions to be stored in style files on disk (one file for
    each color), from where Stata will read the color definitions (if the graph
    system has already been loaded, that is, if you already produced a graph in the
    current session, you will need to clear the graph memory before the stored colors
    become available; use discard or clear all to flush the working memory). The
    color names can then be used just like Stata's official color names. Example:

        . colorpalette Fuchsia Tomato SteelBlue SeaShell, stylefiles
        . discard
        . sysuse auto, clear
        . scatter trunk turn mpg weight, mc(Fuchsia Tomato SteelBlue)
            graphr(color(SeaShell))

    colorpalette will store the style files in folder 'style' in the current working
    directory. That is, the color definitions will be found by Stata as long as you
    do not change the working directory.

    To make the colors permanently available irrespective of the working directory,
    type sylefiles(, personal). In this case the style files will be stored in folder
    'style' within the PERSONAL ado-file directory; see help sysdir.

        +-----------------------------------+
    ----+ Analyzing colors using colorcheck +----------------------------------------

        . colorpalette s2, nograph
        . colorcheck
        . colorcheck, sort(mono)
        . colorcheck, sort(deuter)
        . colorcheck, metric(E2000) nograph
        . colorcheck, mono(0.9) cvd(0.75) vertical


Saved results

    colorpalette stores the following in r() (Syntax 1 only):

    Scalars    
      r(n)            number of returned colors

    Macros     
      r(ptype)        color
      r(pname)        name of palette or custom
      r(pclass)       palette class (if provided)
      r(pnote)        palette description (if provided)
      r(psource)      palette source (if provided)
      r(p)            space separated list of colors
      r(p#)           #th color
      r(p#name)       name of #th color (if provided)
      r(p#info)       info of #th color (if provided)


    colorcheck adds the following to r(), in addition to the results from
    colorpalette:

    Scalars    
      r(mono)         proportion of gray
      r(cvd)          CVD severity

    Macros     
      r(metric)       color difference metric
      r(mono_method)  grayscale conversion method
      r(p_mono)       list of grayscale converted colors
      r(p_deut)       list of deteranomaly transformed colors
      r(p_prot)       list of protanomaly transformed colors
      r(p_trit)       list of tritanomaly transformed colors

    Matrix     
      r(delta)        color difference statistics


References

    Bischof, D. 2017a. G538SCHEMES: module to provide graphics schemes for
        http://fivethirtyeight.com. Available from 
        http://ideas.repec.org/c/boc/bocode/s458404.html.
    Bischof, D. 2017b. New graphic schemes for Stata: plotplain and plottig.  The
        Stata Journal 17(3): 748–759.
    Briatte, F. 2013. SCHEME-BURD: Stata module to provide a ColorBrewer-inspired
        graphics scheme with qualitative and blue-to-red diverging colors. Available
        from http://ideas.repec.org/c/boc/bocode/s457623.html.
    Brewer, C. A., G. W. Hatchard, M. A. Harrower. 2003. ColorBrewer in Print: A
        Catalog of Color Schemes for Maps.  Cartography and Geographic Information
        Science 30(1): 5–32.
    Brewer, C. A. 2016. Designing Better Maps. A Guide for GIS Users. 2nd ed.
        Redlands, CA: Esri Press.
    Buchanan, B. 2015. BREWSCHEME: Stata module for generating customized graph
        scheme files. Available from 
        http://ideas.repec.org/c/boc/bocode/s458050.html.
    Bundesamt für Statistik 2017. Layoutrichtlinien. Gestaltungs und
        Redaktionsrichtlinien für Publikationen, Tabellen und grafische Assets.
        Version 1.1.1. Neuchâtel.
    Crameri, F. (2018). Scientific colour maps. Zenodo. DOI: 10.5281/zenodo.1243862.
    Gomez, M. 2015. Stata command to generate color schemes. Available from 
        http://github.com/matthieugomez/stata-colorscheme.
    Hunter, J. D. 2007. Matplotlib: A 2D graphics environment. Computing in Science &
        Engineering 9(3): 90-95.
    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 http://CRAN.R-project.org/package=colorspace.
    Juul, S. 2003. Lean mainstream schemes for Stata 8 graphics. The Stata Journal
        3(3): 295-301.
    Kovesi, P. (2015). Good Colour Maps: How to Design Them. arXiv:1509.03700
        [cs.GR].
    Lin, S., J. Fortuna, C. Kulkarni, M. Stone, J. Heer. 2013. Selecting
        Semantically-Resonant Colors for Data Visualization. Computer Graphics Forum
        32(3pt4): 401-410.
    Morris, T. 2013. SCHEME-MRC: Stata module to provide graphics scheme for UK
        Medical Research Council. Available from 
        http://ideas.repec.org/c/boc/bocode/s457703.html.
    Morris, T. 2015. SCHEME-TFL: Stata module to provide graph scheme, based on
        Transport for London's corporate colour pallette. Available from 
        http://ideas.repec.org/c/boc/bocode/s458103.html.
    Okabe, M., K. Ito. 2002. Color Universal Design (CUD). How to make figures and
        presentations that are friendly to Colorblind people. Available from 
        http://jfly.iam.u-tokyo.ac.jp/color/.
    Pisati, M. 2007. SPMAP: Stata module to visualize spatial data. Available from 
        http://ideas.repec.org/c/boc/bocode/s456812.html.
    Tol, P. 2012. Colour Schemes. SRON Technical Note, Doc. no. SRON/EPS/TN/09-002.
        Available from http://personal.sron.nl/~pault/colourschemes.pdf.
    Zeileis, A., K. Hornik, P. Murrell. 2009.  Escaping RGBland: Selecting Colors for
        Statistical Graphics.  Computational Statistics & Data Analysis 53:
        3259-3270.


Author

    Ben Jann, University of Bern, ben.jann@unibe.ch

    Thanks for citing this software in one of the following ways:

    Jann, B. 2022. Color palettes for Stata graphics: an update.  University of Bern
        Social Sciences Working Papers No. 43. Available from 
        http://ideas.repec.org/p/bss/wpaper/43.html.
    Jann, B. 2018. Color palettes for Stata graphics. The Stata Journal 18(4):
        765-785.
    Jann, B. 2017. palettes: Stata module providing color palettes, symbol palettes,
        and line pattern palettes. Available from 
        http://ideas.repec.org/c/boc/bocode/s458444.html.


Also see

    Online:  help for colrspace, colorpalette9, symbolpalette, linepalette, grstyle
             set, graph, colorstyle