【问题标题】:What does highlighted colors in Sublime Text 2 signify?Sublime Text 2 中突出显示的颜色表示什么?
【发布时间】:2015-12-09 13:19:39
【问题描述】:

我在一个文件中有这段代码:

background: -moz-linear-gradient(red, orange, yellow, green, blue, indigo, violet);

Sublime Text 2 似乎用浅蓝色突出了indigo 和violet 的背景:

我尝试了更多颜色,其中大多数像 chocolate、aliceblue、pink 等都被突出显示,但其他一些颜色,如 maroon、teal、silver 等没有。

蓝色高亮是什么意思?

【问题讨论】:

    标签: css colors background sublimetext2 highlight


    【解决方案1】:

    这些是"Extended color keywords"

    流行浏览器支持的 X11 颜色 [X11COLORS] SVG 1.0 的灰色/灰色变体。结果列表正是 与SVG 1.0 color keyword names 相同。本规范 将它们的定义扩展到 SVG 之外。

    CSS.tmLanguage的相关部分:

    ...
    <dict>
    <key>color-values</key>
    <dict>
        <key>patterns</key>
        <array>
            ...
            <dict>
                <key>comment</key>
                <string>These colours are mostly recognised but will not validate. ref: http://www.w3schools.com/css/css_colornames.asp</string>
                <key>match</key>
                <string>\b(aliceblue|antiquewhite|aquamarine|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|gainsboro|ghostwhite|gold|goldenrod|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|limegreen|linen|magenta|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|oldlace|olivedrab|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|thistle|tomato|turquoise|violet|wheat|whitesmoke|yellowgreen)\b</string>
                <key>name</key>
                <string>invalid.deprecated.color.w3c-non-standard-color-name.css</string>
            </dict>
            ...
        </array>
    </dict>
    ...
    

    不同的外观是由作用域引起的:

    support.constant.color.w3c-standard-color-name.css(用于标准颜色关键字)
    invalid.deprecated.color.w3c-non-standard-color -name.css(用于扩展颜色关键字)

    【讨论】:

    • 谢谢。什么是 CSS.tmLanguage?
    • @CoolGuy 这是 Sublime Text 的默认 CSS 语法定义。该文件通常位于 Packages 中。
    猜你喜欢
    • 2012-04-06
    • 2017-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多