Skip to content

Commit b918cd4

Browse files
committed
Add --theme() function
1 parent 69873f4 commit b918cd4

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

Tailwind CSS.sublime-syntax

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,43 @@ contexts:
396396
tailwind-at-utility-name-content:
397397
- meta_scope: entity.other.utility-name.css.tailwind
398398
- include: identifier-content
399+
400+
###[ TAILWIND THEME FUNCTIONS ]################################################
401+
402+
font-family-value-content:
403+
- meta_prepend: true
404+
- include: font-family-var-functions
405+
406+
font-family-var-functions:
407+
- match: --theme(?=\()
408+
scope: meta.function-call.identifier.css support.function.theme.css.tailwind
409+
push:
410+
- font-family-var-function-arguments-list-body
411+
- var-function-arguments-identifier
412+
- function-arguments-list-begin
413+
414+
font-family-var-function-arguments-list-body:
415+
- meta_content_scope: meta.function-call.arguments.css meta.group.css
416+
- include: function-arguments-prototype
417+
- include: quoted-strings
418+
- include: global-constants
419+
- include: generic-font-names
420+
- include: font-family-names
421+
422+
var-functions:
423+
- meta_prepend: true
424+
- match: --theme(?=\()
425+
scope: meta.function-call.identifier.css support.function.theme.css.tailwind
426+
push:
427+
- var-function-arguments-defaults
428+
- var-function-arguments-identifier
429+
- function-arguments-list-begin
430+
431+
var-function:
432+
- meta_prepend: true
433+
- match: --theme(?=\()
434+
scope: meta.function-call.identifier.css support.function.theme.css.tailwind
435+
set:
436+
- var-function-arguments-defaults
437+
- var-function-arguments-identifier
438+
- function-arguments-list-begin

tests/syntax_test_tw4.css

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,49 @@
182182
/* ^ punctuation.section.block.end.css */
183183
}
184184
/* <- meta.property-list.css meta.block.css punctuation.section.block.end.css */
185+
186+
.theme-functions {
187+
188+
font-family: --theme(
189+
/* ^^^^^^^^^^ meta.property-value.css */
190+
/* ^^^^^^^ meta.function-call.identifier.css support.function.theme.css.tailwind */
191+
/* ^ meta.function-call.arguments.css meta.group.css punctuation.section.group.begin.css */
192+
--custom-var,
193+
/*^^^^^^^^^^^^^^^^^^^ meta.property-value.css meta.function-call.arguments.css meta.group.css */
194+
/* ^^^^^^^^^^^^ variable.other.custom-property.css */
195+
ui-monospace,
196+
/*^^^^^^^^^^^^^^^^^^^ meta.property-value.css meta.function-call.arguments.css meta.group.css */
197+
/* ^^^^^^^^^^^^ support.constant.property-value.css */
198+
Consolas,
199+
/*^^^^^^^^^^^^^^^ meta.property-value.css meta.function-call.arguments.css meta.group.css */
200+
/* ^^^^^^^^ meta.string.css string.unquoted.css */
201+
'Courier New'
202+
/*^^^^^^^^^^^^^^^^^^^ meta.property-value.css meta.function-call.arguments.css meta.group.css */
203+
/* ^^^^^^^^^^^^^ meta.string.css string.quoted.single.css */
204+
/* ^ punctuation.definition.string.begin.css */
205+
/* ^ punctuation.definition.string.end.css */
206+
);
207+
/*^^^ meta.property-value.css meta.function-call.arguments.css meta.group.css */
208+
/* ^ punctuation.section.group.end.css */
209+
/* ^ punctuation.terminator.rule.css */
210+
211+
font-feature-settings: --theme(--default-settings, normal);
212+
/* ^^^^^^^ meta.function-call.identifier.css support.function.theme.css.tailwind */
213+
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.css meta.group.css */
214+
/* ^ punctuation.section.group.begin.css */
215+
/* ^^^^^^^^^^^^^^^^^^ variable.other.custom-property.css */
216+
/* ^ punctuation.separator.sequence.css */
217+
/* ^^^^^^ support.constant.property-value.css */
218+
/* ^ punctuation.section.group.end.css */
219+
/* ^ punctuation.terminator.rule.css */
220+
221+
color: --theme(--theme-color, red);
222+
/* ^^^^^^^ meta.function-call.identifier.css support.function.theme.css.tailwind */
223+
/* ^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.css meta.group.css */
224+
/* ^ punctuation.section.group.begin.css */
225+
/* ^^^^^^^^^^^^^ variable.other.custom-property.css */
226+
/* ^ punctuation.separator.sequence.css */
227+
/* ^^^ support.constant.color.w3c.standard.css */
228+
/* ^ punctuation.section.group.end.css */
229+
/* ^ punctuation.terminator.rule.css */
230+
}

0 commit comments

Comments
 (0)