xref: /vim-8.2.3635/runtime/syntax/css.vim (revision 2286304c)
1" Vim syntax file
2" Language:     Cascading Style Sheets
3" Previous Contributor List:
4"               Jules Wang      <[email protected]>
5"               Claudio Fleiner <[email protected]>
6"               Yeti            (Add full CSS2, HTML4 support)
7"               Nikolai Weibull (Add CSS2 support)
8" URL:          https://github.com/vim-language-dept/css-syntax.vim
9" Maintainer:   Jay Sitter <[email protected]>
10" Last Change:  2021 Oct 15
11
12" quit when a syntax file was already loaded
13if !exists("main_syntax")
14  if exists("b:current_syntax")
15    finish
16  endif
17  let main_syntax = 'css'
18elseif exists("b:current_syntax") && b:current_syntax == "css"
19  finish
20endif
21
22let s:cpo_save = &cpo
23set cpo&vim
24
25syn case ignore
26" Add dash to allowed keyword characters.
27syn iskeyword @,48-57,_,192-255,-
28
29" HTML4 tags
30syn keyword cssTagName abbr address area a b base
31syn keyword cssTagName bdo blockquote body br button
32syn keyword cssTagName caption cite code col colgroup dd del
33syn keyword cssTagName dfn div dl dt em fieldset form
34syn keyword cssTagName h1 h2 h3 h4 h5 h6 head hr html img i
35syn keyword cssTagName iframe input ins isindex kbd label legend li
36syn keyword cssTagName link map menu meta noscript ol optgroup
37syn keyword cssTagName option p param picture pre q s samp script small
38syn keyword cssTagName span strong sub sup tbody td
39syn keyword cssTagName textarea tfoot th thead title tr ul u var
40syn keyword cssTagName object svg
41syn match   cssTagName /\<select\>\|\<style\>\|\<table\>/
42
43" 34 HTML5 tags
44syn keyword cssTagName article aside audio bdi canvas command data
45syn keyword cssTagName datalist details dialog embed figcaption figure footer
46syn keyword cssTagName header hgroup keygen main mark menuitem meter nav
47syn keyword cssTagName output progress rt rp ruby section
48syn keyword cssTagName source summary time track video wbr
49
50" Tags not supported in HTML5
51" acronym applet basefont big center dir
52" font frame frameset noframes strike tt
53
54syn match cssTagName "\*"
55
56" selectors
57syn match cssSelectorOp "[,>+~]"
58syn match cssSelectorOp2 "[~|^$*]\?=" contained
59syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
60
61" .class and #id
62syn match cssClassName "\.-\=[A-Za-z_][A-Za-z0-9_-]*" contains=cssClassNameDot
63syn match cssClassNameDot contained '\.'
64
65try
66syn match cssIdentifier "#[A-Za-zÀ-ÿ_@][A-Za-zÀ-ÿ0-9_@-]*"
67catch /^.*/
68syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
69endtry
70
71" digits
72syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators
73syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators
74syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\|fr\|vw\|vh\|vmin\|vmax\|ch\)\>" contains=cssUnitDecorators
75syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=%" contains=cssUnitDecorators
76syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators
77syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators
78syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators
79
80" The 16 basic color names
81syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow
82
83" 130 more color names
84syn keyword cssColor contained aliceblue antiquewhite aquamarine azure
85syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood
86syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan
87syn match cssColor contained /\<dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)\>/
88syn match cssColor contained /\<dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)\>/
89syn match cssColor contained /\<darkslate\(blue\|gray\|grey\)\>/
90syn match cssColor contained /\<dark\(turquoise\|violet\)\>/
91syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick
92syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold
93syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink
94syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen
95syn keyword cssColor contained lemonchiffon limegreen linen magenta
96syn match cssColor contained /\<light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)\>/
97syn match cssColor contained /\<light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)\>/
98syn match cssColor contained /\<light\(slategray\|slategrey\|steelblue\)\>/
99syn match cssColor contained /\<medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)\>/
100syn match cssColor contained /\<medium\(slateblue\|springgreen\|turquoise\|violetred\)\>/
101syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite
102syn keyword cssColor contained oldlace olivedrab orange orangered orchid
103syn match cssColor contained /\<pale\(goldenrod\|green\|turquoise\|violetred\)\>/
104syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue
105syn keyword cssColor contained rosybrown royalblue rebeccapurple saddlebrown salmon
106syn keyword cssColor contained sandybrown seagreen seashell sienna skyblue slateblue
107syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan
108syn keyword cssColor contained thistle tomato turquoise violet wheat
109syn keyword cssColor contained whitesmoke yellowgreen
110
111" FIXME: These are actually case-insensitive too, but (a) specs recommend using
112" mixed-case (b) it's hard to highlight the word `Background' correctly in
113" all situations
114syn case match
115syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText Background
116syn case ignore
117
118syn match cssImportant contained "!\s*important\>"
119syn match cssCustomProp contained "--[a-zA-Z0-9-_]*"
120
121syn match cssColor contained "\<transparent\>"
122syn match cssColor contained "\<currentColor\>"
123syn match cssColor contained "\<white\>"
124syn match cssColor contained "#\x\{3,4\}\>" contains=cssUnitDecorators
125syn match cssColor contained "#\x\{6\}\>" contains=cssUnitDecorators
126syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators
127
128syn region cssURL contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline
129syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline
130syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline  contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma
131syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline  contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction
132syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\|conic-\)\=\gradient\s*(" end=")" oneline  contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma
133syn region cssFunction contained matchgroup=cssFunctionName start="\<\(matrix\(3d\)\=\|scale\(3d\|X\|Y\|Z\)\=\|translate\(3d\|X\|Y\|Z\)\=\|skew\(X\|Y\)\=\|rotate\(3d\|X\|Y\|Z\)\=\|perspective\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssValueAngle,cssFunctionComma
134syn region cssFunction contained matchgroup=cssFunctionName start="\<\(blur\|brightness\|contrast\|drop-shadow\|grayscale\|hue-rotate\|invert\|opacity\|saturate\|sepia\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssValueAngle,cssFunctionComma
135syn keyword cssGradientAttr contained top bottom left right cover center middle ellipse at
136syn match cssFunctionComma contained ","
137
138" Common Prop and Attr
139syn keyword cssCommonAttr contained auto none inherit all default normal
140syn keyword cssCommonAttr contained top bottom center stretch hidden visible
141syn match cssCommonAttr contained "\<\(max-\|min-\|fit-\)content\>"
142"------------------------------------------------
143" CSS Animations
144" http://www.w3.org/TR/css3-animations/
145syn match cssAnimationProp contained "\<animation\(-\(delay\|direction\|duration\|fill-mode\|name\|play-state\|timing-function\|iteration-count\)\)\=\>"
146
147" animation-direction attributes
148syn keyword cssAnimationAttr contained alternate reverse
149syn match cssAnimationAttr contained "\<alternate-reverse\>"
150
151" animation-fill-mode attributes
152syn keyword cssAnimationAttr contained forwards backwards both
153
154" animation-play-state attributes
155syn keyword cssAnimationAttr contained running paused
156
157" animation-iteration-count attributes
158syn keyword cssAnimationAttr contained infinite
159"------------------------------------------------
160"  CSS Backgrounds and Borders Module Level 3
161"  http://www.w3.org/TR/css3-background/
162syn match cssBackgroundProp contained "\<background\(-\(attachment\|clip\|color\|image\|origin\|position\|repeat\|size\)\)\=\>"
163" background-attachment attributes
164syn keyword cssBackgroundAttr contained scroll fixed local
165
166" background-position attributes
167syn keyword cssBackgroundAttr contained left center right top bottom
168
169" background-repeat attributes
170syn match cssBackgroundAttr contained "\<no-repeat\>"
171syn match cssBackgroundAttr contained "\<repeat\(-[xy]\)\=\>"
172
173" background-size attributes
174syn keyword cssBackgroundAttr contained cover contain
175
176syn match cssBorderProp contained "\<border\(-\(top\|right\|bottom\|left\)\)\=\(-\(width\|color\|style\)\)\=\>"
177syn match cssBorderProp contained "\<border\(-\(top\|bottom\)-\(left\|right\)\)\=-radius\>"
178syn match cssBorderProp contained "\<border-image\(-\(outset\|repeat\|slice\|source\|width\)\)\=\>"
179syn match cssBorderProp contained "\<box-decoration-break\>"
180syn match cssBorderProp contained "\<box-shadow\>"
181
182" border-image attributes
183syn keyword cssBorderAttr contained stretch round fill
184
185" border-style attributes
186syn keyword cssBorderAttr contained dotted dashed solid double groove ridge inset outset
187
188" border-width attributes
189syn keyword cssBorderAttr contained thin thick medium
190
191" box-decoration-break attributes
192syn keyword cssBorderAttr contained clone slice
193"------------------------------------------------
194
195syn match cssBoxProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>"
196syn match cssBoxProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>"
197syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>"
198syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
199syn keyword cssBoxAttr contained visible hidden scroll auto
200syn match cssBoxAttr contained "\<no-\(display\|content\)\>"
201
202syn keyword cssCascadeProp contained all
203syn keyword cssCascadeAttr contained initial unset revert
204
205syn keyword cssColorProp contained opacity
206syn match cssColorProp contained "\<color-profile\>"
207syn match cssColorProp contained "\<rendering-intent\>"
208
209
210syn match cssDimensionProp contained "\<\(min\|max\)-\(width\|height\)\>"
211syn keyword cssDimensionProp contained height
212syn keyword cssDimensionProp contained width
213
214" CSS Flexible Box Layout Module Level 1
215" http://www.w3.org/TR/css3-flexbox/
216" CSS Box Alignment Module Level 3
217" http://www.w3.org/TR/css-align-3/
218syn match cssFlexibleBoxProp contained "\<flex\(-\(direction\|wrap\|flow\|grow\|shrink\|basis\)\)\=\>"
219syn match cssFlexibleBoxProp contained "\<\(align\|justify\)\(-\(items\|self\|content\)\)\=\>"
220syn keyword cssFlexibleBoxProp contained order
221
222syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>"
223syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center
224syn match cssFlexibleBoxAttr contained "\<flex\(-\(start\|end\)\)\=\>"
225syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\|evenly\)\)\=\>"
226
227" CSS Fonts Module Level 3
228" http://www.w3.org/TR/css-fonts-3/
229syn match cssFontProp contained "\<font\(-\(family\|\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>"
230
231" font attributes
232syn keyword cssFontAttr contained icon menu caption
233syn match cssFontAttr contained "\<message-box\>"
234syn match cssFontAttr contained "\<status-bar\>"
235syn keyword cssFontAttr contained larger smaller
236syn match cssFontAttr contained "\<\(x\{1,2\}-\)\=\(large\|small\)\>"
237syn match cssFontAttr contained "\<small-\(caps\|caption\)\>"
238" font-family attributes
239syn keyword cssFontAttr contained sans-serif serif cursive fantasy monospace
240" font-feature-settings attributes
241syn keyword cssFontAttr contained on off
242" font-stretch attributes
243syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>"
244" font-style attributes
245syn keyword cssFontAttr contained italic oblique
246" font-synthesis attributes
247syn keyword cssFontAttr contained weight style
248" font-weight attributes
249syn keyword cssFontAttr contained bold bolder lighter
250" TODO: font-variant-* attributes
251"------------------------------------------------
252
253" Webkit specific property/attributes
254syn match cssFontProp contained "\<font-smooth\>"
255syn match cssFontAttr contained "\<\(subpixel-\)\=\antialiased\>"
256
257
258" CSS Multi-column Layout Module
259" http://www.w3.org/TR/css3-multicol/
260syn match cssMultiColumnProp contained "\<break-\(after\|before\|inside\)\>"
261syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>"
262syn keyword cssMultiColumnProp contained columns
263syn keyword cssMultiColumnAttr contained balance medium
264syn keyword cssMultiColumnAttr contained always left right page column
265syn match cssMultiColumnAttr contained "\<avoid\(-\(page\|column\)\)\=\>"
266
267" http://www.w3.org/TR/css3-break/#page-break
268syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
269
270" http://www.w3.org/TR/SVG11/interact.html
271syn match cssInteractProp contained "\<pointer-events\>"
272syn match cssInteractAttr contained "\<\(visible\)\=\(Painted\|Fill\|Stroke\)\=\>"
273
274" TODO find following items in w3c docs.
275syn keyword cssGeneratedContentProp contained quotes crop
276syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>"
277syn match cssGeneratedContentProp contained "\<move-to\>"
278syn match cssGeneratedContentProp contained "\<page-policy\>"
279syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
280
281" https://www.w3.org/TR/css-grid-1/
282syn match cssGridProp contained "\<grid\>"
283syn match cssGridProp contained "\<grid-template\(-\(columns\|rows\|areas\)\)\=\>"
284syn match cssGridProp contained "\<grid-\(column\|row\)\(-\(start\|end\|gap\)\)\=\>"
285syn match cssGridProp contained "\<grid-\(area\|gap\)\>"
286syn match cssGridProp contained "\<gap\>"
287syn match cssGridProp contained "\<grid-auto-\(flow\|rows\|columns\)\>"
288
289syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>"
290
291syn match cssListProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>"
292syn match cssListAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>"
293syn match cssListAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>"
294syn match cssListAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>"
295syn keyword cssListAttr contained disc circle square hebrew armenian georgian
296syn keyword cssListAttr contained inside outside
297
298" object-fit https://www.w3.org/TR/css-images-3/#the-object-fit
299syn match cssObjectProp contained "\<object-\(fit\|position\)\>"
300syn keyword cssObjectAttr contained fill contain cover scale-down
301
302syn keyword cssPositioningProp contained bottom clear clip display float left
303syn keyword cssPositioningProp contained position right top visibility
304syn match cssPositioningProp contained "\<z-index\>"
305syn keyword cssPositioningAttr contained block compact grid
306syn match cssPositioningAttr contained "\<table\(-\(row-group\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>"
307syn keyword cssPositioningAttr contained left right both
308syn match cssPositioningAttr contained "\<list-item\>"
309syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\|grid\|flex\)\)\=\>"
310syn match cssPositioningAttr contained "\<flow\(-root\)\=\>"
311syn keyword cssPositioningAttr contained static relative absolute fixed subgrid sticky
312
313syn keyword cssPrintAttr contained landscape portrait crop cross always
314
315syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>"
316syn keyword cssTableAttr contained fixed collapse separate show hide once always
317
318
319syn keyword cssTextProp contained color direction hyphens
320syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
321syn match cssTextProp contained "\<text-\(justify\|outline\|warp\|align-last\|size-adjust\|rendering\|stroke\|indent\)\>"
322syn match cssTextProp contained "\<\(word\|line\)-break\|\(overflow\|word\)-wrap\>"
323syn match cssTextProp contained "\<white-space\>"
324syn match cssTextProp contained "\<hanging-punctuation\>"
325syn match cssTextProp contained "\<tab-size\>"
326syn match cssTextProp contained "\<punctuation-trim\>"
327syn match cssTextAttr contained "\<line-through\>"
328syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
329syn keyword cssTextAttr contained ltr rtl embed nowrap
330syn keyword cssTextAttr contained underline overline blink sub super middle
331syn keyword cssTextAttr contained capitalize uppercase lowercase
332syn keyword cssTextAttr contained justify baseline sub super
333syn keyword cssTextAttr contained optimizeLegibility optimizeSpeed geometricPrecision
334syn match cssTextAttr contained "\<pre\(-\(line\|wrap\)\)\=\>"
335syn match cssTextAttr contained "\<\(allow\|force\)-end\>"
336syn keyword cssTextAttr contained start end adjacent
337syn match cssTextAttr contained "\<inter-\(word\|ideographic\|cluster\)\>"
338syn keyword cssTextAttr contained distribute kashida first last
339syn keyword cssTextAttr contained clip ellipsis unrestricted suppress
340syn match cssTextAttr contained "\<break-all\>"
341syn match cssTextAttr contained "\<break-word\>"
342syn keyword cssTextAttr contained manual
343syn match cssTextAttr contained "\<bidi-override\>"
344
345syn match cssTransformProp contained "\<transform\(-\(origin\|style\)\)\=\>"
346syn match cssTransformProp contained "\<perspective\(-origin\)\=\>"
347syn match cssTransformProp contained "\<backface-visibility\>"
348
349" CSS Transitions
350" http://www.w3.org/TR/css3-transitions/
351syn match cssTransitionProp contained "\<transition\(-\(delay\|duration\|property\|timing-function\)\)\=\>"
352
353" transition-time-function attributes
354syn match cssTransitionAttr contained "\<linear\(-gradient\)\@!\>"
355syn match cssTransitionAttr contained "\<ease\(-\(in-out\|out\|in\)\)\=\>"
356syn match cssTransitionAttr contained "\<step\(-start\|-end\)\=\>"
357"------------------------------------------------
358" CSS Basic User Interface Module Level 3 (CSS3 UI)
359" http://www.w3.org/TR/css3-ui/
360syn match cssUIProp contained "\<box-sizing\>"
361syn match cssUIAttr contained "\<\(content\|padding\|border\)\(-box\)\=\>"
362
363syn keyword cssUIProp contained cursor
364syn match cssUIAttr contained "\<\(\([ns]\=[ew]\=\)\|col\|row\|nesw\|nwse\)-resize\>"
365syn keyword cssUIAttr contained crosshair help move pointer alias copy
366syn keyword cssUIAttr contained progress wait text cell move
367syn match cssUIAttr contained "\<context-menu\>"
368syn match cssUIAttr contained "\<no-drop\>"
369syn match cssUIAttr contained "\<not-allowed\>"
370syn match cssUIAttr contained "\<all-scroll\>"
371syn match cssUIAttr contained "\<\(vertical-\)\=text\>"
372syn match cssUIAttr contained "\<zoom\(-in\|-out\)\=\>"
373
374syn match cssUIProp contained "\<ime-mode\>"
375syn keyword cssUIAttr contained active inactive disabled
376
377syn match cssUIProp contained "\<nav-\(down\|index\|left\|right\|up\)\=\>"
378syn match cssUIProp contained "\<outline\(-\(width\|style\|color\|offset\)\)\=\>"
379syn keyword cssUIAttr contained invert
380
381syn keyword cssUIProp contained icon resize
382syn keyword cssUIAttr contained both horizontal vertical
383
384syn match cssUIProp contained "\<text-overflow\>"
385syn keyword cssUIAttr contained clip ellipsis
386
387syn match cssUIProp contained "\<image-rendering\>"
388syn keyword cssUIAttr contained pixellated
389syn match cssUIAttr contained "\<crisp-edges\>"
390
391"------------------------------------------------
392" Webkit/iOS specific attributes
393syn match cssUIAttr contained '\<preserve-3d\>'
394" IE specific attributes
395syn match cssIEUIAttr contained '\<bicubic\>'
396
397" Webkit/iOS specific properties
398syn match cssUIProp contained '\<tap-highlight-color\|user-select\|touch-callout\>'
399" IE specific properties
400syn match cssIEUIProp contained '\<interpolation-mode\|zoom\|filter\>'
401
402" Webkit/Firebox specific properties/attributes
403syn keyword cssUIProp contained appearance
404syn keyword cssUIAttr contained window button field icon document menu
405
406
407syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>"
408syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numeral\|header\)\)\=\)\>"
409syn keyword cssAuralProp contained volume during azimuth elevation stress richness
410syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>"
411syn keyword cssAuralAttr contained silent
412syn match cssAuralAttr contained "\<spell-out\>"
413syn keyword cssAuralAttr contained non mix
414syn match cssAuralAttr contained "\<\(left\|right\)-side\>"
415syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>"
416syn keyword cssAuralAttr contained leftwards rightwards behind
417syn keyword cssAuralAttr contained below level above lower higher
418syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\|low\|high\)\>"
419syn keyword cssAuralAttr contained faster slower
420syn keyword cssAuralAttr contained male female child code digits continuous
421
422" mobile text
423syn match cssMobileTextProp contained "\<text-size-adjust\>"
424
425syn keyword cssMediaProp contained width height orientation scan
426syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/
427syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/
428syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/
429syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/
430syn keyword cssMediaAttr contained portrait landscape progressive interlace
431syn match cssKeyFrameProp contained /\(\d\+\(\.\d\+\)\?%\|\(\<from\|to\>\)\)/ nextgroup=cssDefinition
432syn match cssPageMarginProp /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition
433syn keyword cssPageProp contained content size
434syn keyword cssPageProp contained orphans widows
435syn keyword cssFontDescriptorProp contained src
436syn match cssFontDescriptorProp contained "\<unicode-range\>"
437" unicode-range attributes
438syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+"
439syn match cssFontDescriptorAttr contained "U+\x\+-\x\+"
440
441syn match cssBraces contained "[{}]"
442syn match cssError contained "{@<>"
443syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssTagName,cssAttributeSelector,cssClassName,cssIdentifier,cssAtRule,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssCustomProp,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold
444syn match cssBraceError "}"
445syn match cssAttrComma ","
446
447" Pseudo class
448" http://www.w3.org/TR/css3-selectors/
449syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssNoise,cssPseudoClassId,cssUnicodeEscape,cssVendor,cssPseudoClassFn
450syn keyword cssPseudoClassId contained link visited active hover before after left right
451syn keyword cssPseudoClassId contained root empty target enable disabled checked invalid
452syn match cssPseudoClassId contained "\<first-\(line\|letter\)\>"
453syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>"
454syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ
455" ------------------------------------
456" Vendor specific properties
457syn match cssPseudoClassId contained  "\<selection\>"
458syn match cssPseudoClassId contained  "\<focus\(-inner\)\=\>"
459syn match cssPseudoClassId contained  "\<\(input-\)\=placeholder\>"
460
461" Misc highlight groups
462syntax match cssUnitDecorators /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained
463syntax match cssNoise contained /\(:\|;\|\/\)/
464
465" Comment
466syn region cssComment start="/\*" end="\*/" contains=@Spell fold
467
468syn match cssUnicodeEscape "\\\x\{1,6}\s\?"
469syn match cssSpecialCharQQ +\\\\\|\\"+ contained
470syn match cssSpecialCharQ +\\\\\|\\'+ contained
471syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ
472syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ
473
474" Vendor Prefix
475syn match cssVendor contained "-\(webkit\|moz\|o\|ms\)-"
476
477" Various CSS Hack characters
478" In earlier versions of IE (6 and 7), one can prefix property names
479" with a _ or * to isolate those definitions to particular versions of IE
480" This is purely decorative and therefore we assign to the same highlight
481" group to cssVendor, for more information:
482" http://www.paulirish.com/2009/browser-specific-css-hacks/
483syn match cssHacks contained /\(_\|*\)/
484
485" Attr Enhance
486" Some keywords are both Prop and Attr, so we have to handle them
487" cssPseudoClassId is hidden by cssAttrRegion, so we add it here. see #69
488syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\|{\)/ contained contains=cssPseudoClassId,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
489
490" Hack for transition
491" 'transition' has Props after ':'.
492syn region cssAttrRegion start=/transition\s*:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
493
494syn match cssAtKeyword /@\(font-face\|media\|keyframes\|import\|charset\|namespace\|page\|supports\)/
495
496syn keyword cssAtRuleLogical only not and contained
497
498" @media
499" Reference: http://www.w3.org/TR/css3-mediaqueries/
500syn region cssAtRule start=/@media\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment,cssCustomProp,cssFunctionName nextgroup=cssDefinition
501syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained
502
503" @page
504" http://www.w3.org/TR/css3-page/
505syn region cssAtRule start=/@page\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssPagePseudo,cssComment nextgroup=cssDefinition
506syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl
507" @keyframe
508" http://www.w3.org/TR/css3-animations/#keyframes
509syn region cssAtRule start=/@\(-[a-z]\+-\)\=keyframes\>/ end=/\ze{/ skipwhite skipnl matchgroup=cssAtKeyword contains=cssVendor,cssComment nextgroup=cssDefinition
510
511syn region cssAtRule start=/@import\>/    end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword,cssURL,cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssMediaType
512syn region cssAtRule start=/@charset\>/   end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword
513syn region cssAtRule start=/@namespace\>/ end=/\ze;/ contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssAtKeyword
514
515" @supports
516" https://www.w3.org/TR/css3-conditional/#at-supports
517syn region cssAtRule start=/@supports\>/ end=/\ze{/ skipwhite skipnl contains=cssAtRuleLogical,cssAttrRegion,css.*Prop,cssValue.*,cssVendor,cssAtKeyword,cssComment nextgroup=cssDefinition
518
519
520if main_syntax == "css"
521  syn sync minlines=10
522endif
523
524" Define the default highlighting.
525" Only when an item doesn't have highlighting yet
526
527hi def link cssComment Comment
528hi def link cssVendor Comment
529hi def link cssHacks Comment
530hi def link cssTagName Statement
531hi def link cssDeprecated Error
532hi def link cssSelectorOp Special
533hi def link cssSelectorOp2 Special
534hi def link cssAttrComma Special
535
536hi def link cssAnimationProp cssProp
537hi def link cssBackgroundProp cssProp
538hi def link cssBorderProp cssProp
539hi def link cssBoxProp cssProp
540hi def link cssCascadeProp cssProp
541hi def link cssColorProp cssProp
542hi def link cssContentForPagedMediaProp cssProp
543hi def link cssDimensionProp cssProp
544hi def link cssFlexibleBoxProp cssProp
545hi def link cssFontProp cssProp
546hi def link cssGeneratedContentProp cssProp
547hi def link cssGridProp cssProp
548hi def link cssHyerlinkProp cssProp
549hi def link cssInteractProp cssProp
550hi def link cssLineboxProp cssProp
551hi def link cssListProp cssProp
552hi def link cssMarqueeProp cssProp
553hi def link cssMultiColumnProp cssProp
554hi def link cssPagedMediaProp cssProp
555hi def link cssPositioningProp cssProp
556hi def link cssObjectProp cssProp
557hi def link cssPrintProp cssProp
558hi def link cssRubyProp cssProp
559hi def link cssSpeechProp cssProp
560hi def link cssTableProp cssProp
561hi def link cssTextProp cssProp
562hi def link cssTransformProp cssProp
563hi def link cssTransitionProp cssProp
564hi def link cssUIProp cssProp
565hi def link cssIEUIProp cssProp
566hi def link cssAuralProp cssProp
567hi def link cssRenderProp cssProp
568hi def link cssMobileTextProp cssProp
569
570hi def link cssAnimationAttr cssAttr
571hi def link cssBackgroundAttr cssAttr
572hi def link cssBorderAttr cssAttr
573hi def link cssBoxAttr cssAttr
574hi def link cssContentForPagedMediaAttr cssAttr
575hi def link cssDimensionAttr cssAttr
576hi def link cssFlexibleBoxAttr cssAttr
577hi def link cssFontAttr cssAttr
578hi def link cssGeneratedContentAttr cssAttr
579hi def link cssGridAttr cssAttr
580hi def link cssHyerlinkAttr cssAttr
581hi def link cssInteractAttr cssAttr
582hi def link cssLineboxAttr cssAttr
583hi def link cssListAttr cssAttr
584hi def link cssMarginAttr cssAttr
585hi def link cssMarqueeAttr cssAttr
586hi def link cssMultiColumnAttr cssAttr
587hi def link cssPaddingAttr cssAttr
588hi def link cssPagedMediaAttr cssAttr
589hi def link cssPositioningAttr cssAttr
590hi def link cssObjectAttr cssAttr
591hi def link cssGradientAttr cssAttr
592hi def link cssPrintAttr cssAttr
593hi def link cssRubyAttr cssAttr
594hi def link cssSpeechAttr cssAttr
595hi def link cssTableAttr cssAttr
596hi def link cssTextAttr cssAttr
597hi def link cssTransformAttr cssAttr
598hi def link cssTransitionAttr cssAttr
599hi def link cssUIAttr cssAttr
600hi def link cssIEUIAttr cssAttr
601hi def link cssAuralAttr cssAttr
602hi def link cssRenderAttr cssAttr
603hi def link cssCascadeAttr cssAttr
604hi def link cssCommonAttr cssAttr
605
606hi def link cssPseudoClassId PreProc
607hi def link cssPseudoClassLang Constant
608hi def link cssValueLength Number
609hi def link cssValueInteger Number
610hi def link cssValueNumber Number
611hi def link cssValueAngle Number
612hi def link cssValueTime Number
613hi def link cssValueFrequency Number
614hi def link cssFunction Constant
615hi def link cssURL String
616hi def link cssFunctionName Function
617hi def link cssFunctionComma Function
618hi def link cssColor Constant
619hi def link cssIdentifier Function
620hi def link cssAtRule Include
621hi def link cssAtKeyword PreProc
622hi def link cssImportant Special
623hi def link cssCustomProp Special
624hi def link cssBraces Function
625hi def link cssBraceError Error
626hi def link cssError Error
627hi def link cssUnicodeEscape Special
628hi def link cssStringQQ String
629hi def link cssStringQ String
630hi def link cssAttributeSelector String
631hi def link cssMediaType Special
632hi def link cssMediaComma Normal
633hi def link cssAtRuleLogical Statement
634hi def link cssMediaProp cssProp
635hi def link cssMediaAttr cssAttr
636hi def link cssPagePseudo PreProc
637hi def link cssPageMarginProp cssAtKeyword
638hi def link cssPageProp cssProp
639hi def link cssKeyFrameProp Constant
640hi def link cssFontDescriptor Special
641hi def link cssFontDescriptorProp cssProp
642hi def link cssFontDescriptorAttr cssAttr
643hi def link cssUnicodeRange Constant
644hi def link cssClassName Function
645hi def link cssClassNameDot Function
646hi def link cssProp StorageClass
647hi def link cssAttr Constant
648hi def link cssUnitDecorators Number
649hi def link cssNoise Noise
650
651let b:current_syntax = "css"
652
653if main_syntax == 'css'
654  unlet main_syntax
655endif
656
657let &cpo = s:cpo_save
658unlet s:cpo_save
659
660" vim: ts=8
661