Documentation Color Schemes

The highlighting of source code and prose in Sublime Text is controlled by a color scheme. A color scheme assigns colors and font styles to scopes, which are assigned to the text by the syntax. The rest of the look of the user interface is controlled by the theme. The theme controls such elements as buttons select lists, the sidebar and tabs.

Sublime Text color schemes are implemented via the .tmTheme format created by TextMate. It is an XML format split into a global settings and scope styles.

Example

The following is an example of the format of a .tmTheme file. A complete color scheme will have many more scope styles to cover the standard scope names.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Example Color Scheme</string>
    <key>settings</key>
    <array>
        <!-- Global settings -->
        <dict>
            <key>settings</key>
            <dict>
                <key>background</key>
                <string>#222222</string>
                <key>foreground</key>
                <string>#EEEEEE</string>
                <key>caret</key>
                <string>#FFFFFF</string>
            </dict>
        </dict>
        <!-- Scope styles -->
        <dict>
            <key>name</key>
            <string>Comment</string>
            <key>scope</key>
            <string>comment</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#888888</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>String</string>
            <key>scope</key>
            <string>string</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#FFD500</string>
            </dict>
        </dict>
        <dict>
            <key>name</key>
            <string>Number</string>
            <key>scope</key>
            <string>constant.numeric</string>
            <key>settings</key>
            <dict>
                <key>foreground</key>
                <string>#7F00FF</string>
            </dict>
        </dict>
    </array>
</dict>

Colors

Colors in color schemes may be specified using of three formats: hex RGB, hex RGBA or (X11) named.

The hex RGB format consists of the first two characters representing the red channel, the second two green and the final two represent blue. The specify red in hex RGB, write #FF0000.

The hex RGBA format starts the same as hex RGB, but adds a fourth pair of hex characters that control the opacity. To specify red with 50% opacity in hex RGBA, write #FF000080.

Named colors use X11 color names. Please note that while some share names with CSS named colors, the actual colors tend to differ.

Global Settings

The following global settings go in the first <dict>, and are specified using <key>/<string> pairs.

background
The default background color
foreground
The default color for text
caret
The color of the caret
lineHighlight
The background color of the line containing the caret. Only used when the highlight_line setting is enabled.

Accents

misspelling
The color to use for the squiggly underline drawn under misspelled words.
minimapBorder
The color of the border drawn around the viewport area of the minimap when the setting draw_minimap_border is enabled. Note that the viewport is normally only visible on hover, unless the always_show_minimap_viewport setting is enabled.
accent
A color made available for use by the theme. The Default theme uses this to highlight modified tabs when the highlight_modified_tabs setting is enabled.

CSS

CSS is applied to minihtml content created via the popups and phantoms functionality that is exposed through the API. Supported CSS properties are discussed in the minihtml CSS reference.

Plugins that use minihtml are encouraged to set a unique id attribute on the <body> tag of generated HTML to allow color schemes to override default plugin styles.

popupCss
CSS passed to popups.
phantomCss
CSS passed to phantoms. If not specified, uses popupCss.

Gutter

gutter
The background color of the gutter
gutterForeground
The color of line numbers in the gutter

Selection

selection
The background color of selected text
selectionForeground
A color that will override the scope-based text color of the selection
selectionBorder
The color for the border of the selection
inactiveSelection
The background color of a selection in a view that is not currently focused
inactiveSelectionForeground
A color that will override the scope-based text color of the selection in a view that is not currently focused

Find

highlight
The border color for "other" matches when the Highlight matches option is selected in the Find panel. Also used to highlight matches in Find in Files results.
findHighlight
The background color of text matched by the Find panel
findHighlightForeground
A color that will override the scope-based text color of text matched by the Find panel

Guides

Guides are controlled globally by the draw_indent_guides setting.

guide
The color used to draw indent guides. Only used if the option "draw_normal" is present in the setting indent_guide_options.
activeGuide
The color used to draw the indent guides for the indentation levels containing the caret. Only used if the option "draw_active" is present in the setting indent_guide_options.
stackGuide
The color used to draw the indent guides for the parent indentation levels of the indentation level containing the caret. Only used if the option "draw_active" is present in the setting indent_guide_options.

Brackets

Bracket matching is controlled globally by the match_brackets setting.

bracketsOptions

How brackets are highlighted when the caret is next to one. Accepts a space-separated list from the following:

  • underline
  • stippled_underline
  • squiggly_underline
  • foreground
bracketsForeground
The color to use when drawing the style specified by bracketsOptions.
bracketContentsOptions

How brackets are highlighted when the caret is positioned in between a pair of brackets. Accepts a space-separated list from the following:

  • underline
  • stippled_underline
  • squiggly_underline
  • foreground
bracketContentsForeground
The color to use when drawing the style specified by bracketsContentsOptions.

Tags

Tag matching is controlled globally by the match_tags setting.

tagsOptions

How tags are highlighted when the caret is inside of one. Accepts a space-separated list from the following:

  • underline
  • stippled_underline
  • squiggly_underline
  • foreground
tagsForeground
The color to use when drawing the style specified by tagsOptions.

Shadows

shadow
The color of the shadow used to show when a text area can be horizontally scrolled
shadowWidth
The width of the shadow in device-independent pixels

Scope Styles

Color schemes interact with the text in a file via scopes. Scopes are set to code or prose tokens via the syntax. Scopes are dotted strings, specified from least-to-most specific. For example, the if keyword in PHP could be specified via the scope name keyword.control.php.

Matching

Color schemes apply colors and font styles to the scopes by matching the dotted labels, starting with the first. Prefix matching is the standard way to have a color scheme apply to multiple syntaxes. Instead of matching keyword.control.php, most color schemes will instead assign a color to keyword. Matching the first one or two labels in a scope is most common. Including the final label, the syntax name, is uncommon unless a syntax-specific override is desired.

Naming

Author of syntaxes can assign whatever scopes they want to a given token. This combined with the fact that there are hundreds of community-maintained syntaxes means that is can be hard to know what scopes to target. The official Scope Naming guidelines were established to help syntax and color scheme authors use a common set, for better interoperability. The Usage in Color Schemes section provides a baseline set of scopes that color scheme authors should strive to handle.

Style Rules

Each scope style rule consists of a <dict> tag containing three pairs of <key>/<string> tags, with the following keys:

  • name – the (arbitrary) name for the scope rule
  • scope – the scope to apply the settings to
  • settings – a <dict> of settings

The settings <dict> tag may contain one or more of the following <key> tags:

  • foreground – the text color
  • background – the background color
  • fontStyle – zero or more of bold, italic, separated by spaces

Examples

The following scope style rule will color all strings as green:

<dict>
    <key>name</key>
    <string>Strings</string>
    <key>scope</key>
    <string>string</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#00FF00</string>
    </dict>
</dict>

To style all numbers as bold, italic red, use:

<dict>
    <key>name</key>
    <string>Numbers</string>
    <key>scope</key>
    <string>constant.numeric</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#FF0000</string>
        <key>fontStyle</key>
        <string>bold italic</string>
    </dict>
</dict>

Appendix: X11 Colors

aliceblue
antiquewhite
antiquewhite1
antiquewhite2
antiquewhite3
antiquewhite4
aquamarine
aquamarine1
aquamarine2
aquamarine3
aquamarine4
azure
azure1
azure2
azure3
azure4
barely blushing
beige
bisque
bisque1
bisque2
bisque2
bisque3
bisque4
black
blanchedalmond
blue
blue1
blue2
blue3
blue4
blueviolet
brown
brown1
brown2
brown3
brown4
burlywood
burlywood1
burlywood2
burlywood3
burlywood4
cadetblue
cadetblue1
cadetblue2
cadetblue3
cadetblue4
carmel tan
chartreuse
chartreuse1
chartreuse2
chartreuse3
chartreuse4
chocolate
chocolate1
chocolate2
chocolate3
chocolate4
coral
coral1
coral2
coral3
coral4
cornflowerblue
cornsilk
cornsilk1
cornsilk2
cornsilk3
cornsilk4
crimson
cyan
cyan1
cyan2
cyan3
cyan4
darkblue
darkcyan
darkgoldenrod
darkgoldenrod1
darkgoldenrod2
darkgoldenrod3
darkgoldenrod4
darkgray
darkgreen
darkgrey
darkkhaki
darkmagenta
darkolivegreen
darkolivegreen1
darkolivegreen2
darkolivegreen3
darkolivegreen4
darkorange
darkorange1
darkorange2
darkorange3
darkorange4
darkorchid
darkorchid1
darkorchid2
darkorchid3
darkorchid4
darkred
darksalmon
darkseagreen
darkseagreen1
darkseagreen2
darkseagreen3
darkseagreen4
darkslateblue
darkslategray
darkslategray1
darkslategray2
darkslategray3
darkslategray4
darkslategrey
darkturquoise
darkviolet
deeppink
deeppink1
deeppink2
deeppink3
deeppink4
deepskyblue
deepskyblue1
deepskyblue2
deepskyblue3
deepskyblue4
dimgray
dimgrey
dodgerblue
dodgerblue1
dodgerblue2
dodgerblue3
dodgerblue4
dove beige
dusted pink
dusty trail
eggshell cream
far horizon
firebrick
firebrick1
firebrick2
firebrick3
firebrick4
floralwhite
forestgreen
frosted lime
frosted peach
gainsboro
ghostwhite
gold
gold1
gold2
gold3
gold4
goldenrod
goldenrod1
goldenrod2
goldenrod3
goldenrod4
gray
gray cliffs
gray0
gray1
gray10
gray100
gray11
gray12
gray13
gray14
gray15
gray16
gray17
gray18
gray19
gray2
gray20
gray21
gray22
gray23
gray24
gray25
gray26
gray27
gray28
gray29
gray3
gray30
gray31
gray32
gray33
gray34
gray35
gray36
gray37
gray38
gray39
gray4
gray40
gray41
gray42
gray43
gray44
gray45
gray46
gray47
gray48
gray49
gray5
gray50
gray51
gray52
gray53
gray54
gray55
gray56
gray57
gray58
gray59
gray6
gray60
gray61
gray62
gray63
gray64
gray65
gray66
gray67
gray68
gray69
gray7
gray70
gray71
gray72
gray73
gray74
gray75
gray76
gray77
gray78
gray79
gray8
gray80
gray81
gray82
gray83
gray84
gray85
gray86
gray87
gray88
gray89
gray9
gray90
gray91
gray92
gray93
gray94
gray95
gray96
gray97
gray98
gray99
green
green veil
green1
green2
green3
green4
greenyellow
grey
grey0
grey1
grey10
grey100
grey11
grey12
grey13
grey14
grey15
grey16
grey17
grey18
grey19
grey2
grey20
grey21
grey22
grey23
grey24
grey25
grey26
grey27
grey28
grey29
grey3
grey30
grey31
grey32
grey33
grey34
grey35
grey36
grey37
grey38
grey39
grey4
grey40
grey41
grey42
grey43
grey44
grey45
grey46
grey47
grey48
grey49
grey5
grey50
grey51
grey52
grey53
grey54
grey55
grey56
grey57
grey58
grey59
grey6
grey60
grey61
grey62
grey63
grey64
grey65
grey66
grey67
grey68
grey69
grey7
grey70
grey71
grey72
grey73
grey74
grey75
grey76
grey77
grey78
grey79
grey8
grey80
grey81
grey82
grey83
grey84
grey85
grey86
grey87
grey88
grey89
grey9
grey90
grey91
grey92
grey93
grey94
grey95
grey96
grey97
grey98
grey99
honeydew
honeydew1
honeydew2
honeydew3
honeydew4
hotpink
hotpink1
hotpink2
hotpink3
hotpink4
indianred
indianred1
indianred2
indianred3
indianred4
indigo
indigo2
ivory
ivory tusk
ivory1
ivory2
ivory3
ivory4
khaki
khaki1
khaki2
khaki3
khaki4
lavender
lavenderblush
lavenderblush1
lavenderblush2
lavenderblush3
lavenderblush4
lawngreen
lemonchiffon
lemonchiffon1
lemonchiffon2
lemonchiffon3
lemonchiffon4
light adobe
light sand
lightblue
lightblue1
lightblue2
lightblue3
lightblue4
lightcoral
lightcyan
lightcyan1
lightcyan2
lightcyan3
lightcyan4
lightgoldenrod
lightgoldenrod1
lightgoldenrod2
lightgoldenrod3
lightgoldenrod4
lightgoldenrodyellow
lightgray
lightgreen
lightgrey
lightpink
lightpink1
lightpink2
lightpink3
lightpink4
lightsalmon
lightsalmon1
lightsalmon2
lightsalmon3
lightsalmon4
lightseagreen
lightskyblue
lightskyblue1
lightskyblue2
lightskyblue3
lightskyblue4
lightslateblue
lightslategray
lightslategrey
lightsteelblue
lightsteelblue1
lightsteelblue2
lightsteelblue3
lightsteelblue4
lightyellow
lightyellow1
lightyellow2
lightyellow3
lightyellow4
limegreen
linen
magenta
magenta1
magenta2
magenta3
magenta4
maroon
maroon1
maroon2
maroon3
maroon4
mediumaquamarine
mediumblue
mediumorchid
mediumorchid1
mediumorchid2
mediumorchid3
mediumorchid4
mediumpurple
mediumpurple1
mediumpurple2
mediumpurple3
mediumpurple4
mediumseagreen
mediumslateblue
mediumspringgreen
mediumturquoise
mediumvioletred
midnightblue
mintcream
mistyrose
mistyrose1
mistyrose2
mistyrose3
mistyrose4
moccasin
morning fog
navajowhite
navajowhite1
navajowhite2
navajowhite3
navajowhite4
navy
navyblue
oldlace
olivedrab
olivedrab1
olivedrab2
olivedrab3
olivedrab4
orange
orange1
orange2
orange3
orange4
orangered
orangered1
orangered2
orangered3
orangered4
orchid
orchid1
orchid2
orchid3
orchid4
ostrich feather
pale olive
palegoldenrod
palegreen
palegreen1
palegreen2
palegreen3
palegreen4
paleturquoise
paleturquoise1
paleturquoise2
paleturquoise3
paleturquoise4
palevioletred
palevioletred1
palevioletred2
palevioletred3
palevioletred4
papayawhip
peachpuff
peachpuff1
peachpuff2
peachpuff3
peachpuff4
pearly gates
peru
pink
pink1
pink2
pink3
pink4
plantation white
plum
plum1
plum2
plum3
plum4
porcelain white
powderblue
purple
purple1
purple2
purple3
purple4
red
red1
red2
red3
red4
rosybrown
rosybrown1
rosybrown2
rosybrown3
rosybrown4
royalblue
royalblue1
royalblue2
royalblue3
royalblue4
saddlebrown
salmon
salmon1
salmon2
salmon3
salmon4
sand box
sandybrown
seagreen
seagreen1
seagreen2
seagreen3
seagreen4
seashell
seashell1
seashell2
seashell3
seashell4
sgibeet
sgibrightgray
sgibrightgrey
sgichartreuse
sgidarkgray
sgidarkgrey
sgigray0
sgigray100
sgigray12
sgigray16
sgigray20
sgigray24
sgigray28
sgigray32
sgigray36
sgigray4
sgigray40
sgigray44
sgigray48
sgigray52
sgigray56
sgigray60
sgigray64
sgigray68
sgigray72
sgigray76
sgigray8
sgigray80
sgigray84
sgigray88
sgigray92
sgigray96
sgigrey0
sgigrey100
sgigrey12
sgigrey16
sgigrey20
sgigrey24
sgigrey28
sgigrey32
sgigrey36
sgigrey4
sgigrey40
sgigrey44
sgigrey48
sgigrey52
sgigrey56
sgigrey60
sgigrey64
sgigrey68
sgigrey72
sgigrey76
sgigrey8
sgigrey80
sgigrey84
sgigrey88
sgigrey92
sgigrey96
sgilightblue
sgilightgray
sgilightgrey
sgimediumgray
sgimediumgrey
sgiolivedrab
sgisalmon
sgislateblue
sgiteal
sgiverydarkgray
sgiverydarkgrey
sgiverylightgray
sgiverylightgrey
sienna
sienna1
sienna2
sienna3
sienna4
skyblue
skyblue1
skyblue2
skyblue3
skyblue4
slateblue
slateblue1
slateblue2
slateblue3
slateblue4
slategray
slategray1
slategray2
slategray3
slategray4
slategrey
snow
snow1
snow2
snow3
snow4
springgreen
springgreen1
springgreen2
springgreen3
springgreen4
steelblue
steelblue1
steelblue2
steelblue3
steelblue4
subtle white
tan
tan1
tan2
tan3
tan4
thistle
thistle1
thistle2
thistle3
thistle4
toasted meringue
tomato
tomato1
tomato2
tomato3
tomato4
turquoise
turquoise1
turquoise2
turquoise3
turquoise4
ultra pure white
violet
violetred
violetred1
violetred2
violetred3
violetred4
warm shadow
warm summer
wedding veil
wheat
wheat1
wheat2
wheat3
wheat4
white
white orchid
white sail
whitesmoke
yellow
yellow1
yellow2
yellow3
yellow4
yellowgreen