From 275bda7c912c8adaddb482f8e38432b3f8d98ae2 Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Sat, 30 Nov 2024 01:13:49 +0000 Subject: Sat Nov 30 01:13:49 AM UTC 2024 --- config.toml | 2 + content/blog/blacklight-shader.md | 107 + highlight_themes/Everforest Dark.tmTheme | 3186 ++++++++++++++++++++++++++++++ sass/style.scss | 6 +- syntaxes/wgsl.sublime-syntax | 215 ++ 5 files changed, 3515 insertions(+), 1 deletion(-) create mode 100644 content/blog/blacklight-shader.md create mode 100644 highlight_themes/Everforest Dark.tmTheme create mode 100644 syntaxes/wgsl.sublime-syntax diff --git a/config.toml b/config.toml index a706e9c..b22e02b 100644 --- a/config.toml +++ b/config.toml @@ -22,6 +22,8 @@ taxonomies = [ # Whether to do syntax highlighting # Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola highlight_code = true +highlight_theme = "Everforest Dark" +extra_syntaxes_and_themes = ["highlight_themes", "syntaxes"] # Whether external links are to be opened in a new tab # If this is true, a `rel="noopener"` will always automatically be added for security reasons diff --git a/content/blog/blacklight-shader.md b/content/blog/blacklight-shader.md new file mode 100644 index 0000000..bbde2b3 --- /dev/null +++ b/content/blog/blacklight-shader.md @@ -0,0 +1,107 @@ ++++ +title = "creating a blacklight shader" +date = 2024-11-29 +draft = true ++++ + +today i wanted to take a bit of time to write about a shader i implemented for my in-progress game project (more on that soon™) + +i wanted to create a "blacklight" effect, where specific lights could reveal part of the base texture. this shader works with **spot lights** only, but could be extended to work with point lights + +// TODO: image of finished shader + +i wrote this shader in wgsl for a [bevy engine](https://bevyengine.org) project, but it should translate easily to other shading languages + +the finished shader can be found as part of [this repo](https://github.com/exvacuum/bevy_blacklight_material) +## shader inputs + +for this shader, i wanted the following features: +- the number of lights should be dynamic +- the revealed portion of the object should match the area illuminated by each light + - the falloff of the light over distance should match the fading of the object + +for this to work i need the following information about each light: +- position (world space) +- direction (world space) +- range +- inner and outer angle + - these will control the falloff of the light at its edges + - outer angle should be less than pi/2 radians + - inner angle should be less than the outer angle + +i also need some info from the vertex shader: +- position (**world space!**) +- uv + +bevy's default pbr vertex shader provides this information, but as long as you can get this info into your fragment shader you should be good to go + +lastly i'll take a base color texture and a sampler + +with all of that, i can start off the shader by setting up the inputs and fragment entry point: + +```wgsl +#import bevy_pbr::forward_io::VertexOutput; + +struct BlackLight { + position: vec3, + direction: vec3, + range: f32, + inner_angle: f32, + outer_angle: f32, +} + +@group(2) @binding(0) var lights: array; +@group(2) @binding(1) var base_texture: texture_2d; +@group(2) @binding(2) var base_sampler: sampler; + +@fragment +fn fragment( + in: VertexOutput, +) -> @location(0) vec4 { +} +``` +(bevy uses group 2 for custom shader bindings) + +since the number of lights is dynamic, i use a [storage buffer](https://google.github.io/tour-of-wgsl/types/arrays/runtime-sized-arrays/) to store that information + +## shader calculations + +the first thing we'll need to know is how close to looking at the fragment the light source is + +we can get this information using some interesting math: + +```wgsl +let light = lights[0]; +let light_to_fragment_direction = normalize(in.world_position.xyz - light.position); +let light_to_fragment_angle = acos(dot(light.direction, light_to_fragment_direction)); +``` + +the first step of this is taking the dot product of light direction and the direction from the light to the fragment + +since both direction vectors are normalized, the dot product will be between -1.0 and 1.0 + +the dot product of two unit vectors is the cosine of the angle between them ([proof here](https://math.libretexts.org/Bookshelves/Calculus/Calculus_(OpenStax)/12%3A_Vectors_in_Space/12.03%3A_The_Dot_Product#Evaluating_a_Dot_Product)) + +therefore, we take the arccosine of that dot product to get the angle between the light and the fragment + +once we have this angle we can plug it in to an inverse square falloff based on the angle properties of the light: + +```wgsl +let angle_inner_factor = light.inner_angle/light.outer_angle; +let angle_factor = inverse_falloff_radius(light_to_fragment_angle / light.outer_angle, angle_inner_factor))); +``` +```wgsl +fn inverse_falloff(factor: f32) -> f32 { + let squared = factor * factor; + return 1.0/squared; +} + +fn inverse_falloff_radius(factor: f32, radius: f32) -> f32 { + if factor < radius { + return 1.0; + } else { + return inverse_falloff((factor - radius) / (1.0 - radius)); + } +} +``` + diff --git a/highlight_themes/Everforest Dark.tmTheme b/highlight_themes/Everforest Dark.tmTheme new file mode 100644 index 0000000..0e58238 --- /dev/null +++ b/highlight_themes/Everforest Dark.tmTheme @@ -0,0 +1,3186 @@ + + + + + name + Everforest Dark + settings + + + settings + + accent + #a7c080 + background + #2d353b + caret + #d3c6aa + foreground + #d3c6aa + lineHighlight + #3d484d90 + selection + #475258c0 + activeGuide + #9aa79d20 + findHighlight + #899c4040 + misspelling + #da6362 + + + + name + GitGutter deleted + scope + markup.deleted.git_gutter + settings + + foreground + #e67e80a0 + + + + name + GitGutter inserted + scope + markup.inserted.git_gutter + settings + + foreground + #a7c080a0 + + + + name + GitGutter changed + scope + markup.changed.git_gutter + settings + + foreground + #7fbbb3a0 + + + + name + GitGutter untracked + scope + markup.untracked.git_gutter + settings + + foreground + #dbbc7fa0 + + + + name + GitGutter ignored + scope + markup.ignored.git_gutter + settings + + foreground + #4f585e + + + + name + GitGutter comment + scope + comment.line.annotation.git_gutter + settings + + foreground + + name + Comment + scope + comment, string.comment, punctuation.definition.comment + settings + + foreground + #859289 + fontStyle + italic + + + + + + name + Keyword + scope + keyword, storage.type.function, storage.type.class, storage.type.enum, storage.type.interface, storage.type.property, keyword.operator.new, keyword.operator.expression, keyword.operator.new, keyword.operator.delete, storage.type.extends + settings + + foreground + #e67e80 + + + + name + Debug + scope + keyword.other.debugger + settings + + foreground + #e67e80 + + + + name + Storage + scope + storage, modifier, keyword.var, entity.name.tag, keyword.control.case, keyword.control.switch + settings + + foreground + #e69875 + + + + name + Operator + scope + keyword.operator + settings + + foreground + #e69875 + + + + name + String + scope + string, punctuation.definition.string.end, punctuation.definition.string.begin, punctuation.definition.string.template.begin, punctuation.definition.string.template.end + settings + + foreground + #dbbc7f + + + + name + Attribute + scope + entity.other.attribute-name + settings + + foreground + #dbbc7f + + + + name + String Escape + scope + constant.character.escape, punctuation.quasi.element, punctuation.definition.template-expression, punctuation.section.embedded, storage.type.format, constant.other.placeholder, constant.other.placeholder, variable.interpolation + settings + + foreground + #a7c080 + + + + name + Function + scope + entity.name.function, support.function, meta.function, meta.function-call, meta.definition.method + settings + + foreground + #a7c080 + + + + name + Preproc + scope + keyword.control.at-rule, keyword.control.import, keyword.control.export, storage.type.namespace, punctuation.decorator, keyword.control.directive, keyword.preprocessor, punctuation.definition.preprocessor, punctuation.definition.directive, keyword.other.import, keyword.other.package, entity.name.type.namespace, entity.name.scope-resolution, keyword.other.using, keyword.package, keyword.import, keyword.map + settings + + foreground + #83c092 + + + + name + Annotation + scope + storage.type.annotation + settings + + foreground + #83c092 + + + + name + Label + scope + entity.name.label, constant.other.label + settings + + foreground + #83c092 + + + + name + Modules + scope + support.module, support.node, support.other.module, support.type.object.module, entity.name.type.module, entity.name.type.class.module, keyword.control.module + settings + + foreground + #83c092 + + + + name + Type + scope + storage.type, support.type, entity.name.type, keyword.type + settings + + foreground + #7fbbb3 + + + + name + Class + scope + entity.name.type.class, support.class, entity.name.class, entity.other.inherited-class, storage.class + settings + + foreground + #7fbbb3 + + + + name + Number + scope + constant.numeric + settings + + foreground + #d699b6 + + + + name + Boolean + scope + constant.language.boolean + settings + + foreground + #d699b6 + + + + name + Macro + scope + entity.name.function.preprocessor + settings + + foreground + #d699b6 + + + + name + Special identifier + scope + variable.language.this, variable.language.self, variable.language.super, keyword.other.this, variable.language.special, constant.language.null, constant.language.undefined, constant.language.nan + settings + + foreground + #d699b6 + + + + name + Constant + scope + constant.language, support.constant + settings + + foreground + #d699b6 + + + + name + Identifier + scope + variable, support.variable, meta.definition.variable + settings + + foreground + #d3c6aa + + + + name + Property + scope + variable.object.property, support.variable.property, variable.other.property, variable.other.object.property, variable.other.enummember, variable.other.member, meta.object-literal.key + settings + + foreground + #d3c6aa + + + + name + Delimiter + scope + punctuation, meta.brace, meta.delimiter, meta.bracket + settings + + foreground + #d3c6aa + + + + name + Markdown heading1 + scope + heading.1.markdown, markup.heading.setext.1.markdown + settings + + foreground + #e67e80 + fontStyle + bold + + + + name + Markdown heading2 + scope + heading.2.markdown, markup.heading.setext.2.markdown + settings + + foreground + #e69875 + fontStyle + bold + + + + name + Markdown heading3 + scope + heading.3.markdown + settings + + foreground + #dbbc7f + fontStyle + bold + + + + name + Markdown heading4 + scope + heading.4.markdown + settings + + foreground + #a7c080 + fontStyle + bold + + + + name + Markdown heading5 + scope + heading.5.markdown + settings + + foreground + #7fbbb3 + fontStyle + bold + + + + name + Markdown heading6 + scope + heading.6.markdown + settings + + foreground + #d699b6 + fontStyle + bold + + + + name + Markdown heading delimiter + scope + punctuation.definition.heading.markdown + settings + + foreground + #859289 + fontStyle + regular + + + + name + Markdown link + scope + string.other.link.title.markdown, constant.other.reference.link.markdown, string.other.link.description.markdown + settings + + foreground + #d699b6 + fontStyle + regular + + + + name + Markdown link text + scope + markup.underline.link.image.markdown, markup.underline.link.markdown + settings + + foreground + #a7c080 + fontStyle + underline + + + + name + Markdown delimiter + scope + punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown, punctuation.definition.italic.markdown, punctuation.definition.quote.begin.markdown, punctuation.definition.metadata.markdown, punctuation.separator.key-value.markdown, punctuation.definition.constant.markdown + settings + + foreground + #859289 + + + + name + Markdown bold delimiter + scope + punctuation.definition.bold.markdown + settings + + foreground + #859289 + fontStyle + regular + + + + name + Markdown separator delimiter + scope + meta.separator.markdown, punctuation.definition.constant.begin.markdown, punctuation.definition.constant.end.markdown + settings + + foreground + #859289 + fontStyle + bold + + + + name + Markdown italic + scope + markup.italic + settings + + fontStyle + italic + + + + name + Markdown bold + scope + markup.bold + settings + + fontStyle + bold + + + + name + Markdown bold italic + scope + markup.bold markup.italic, markup.italic markup.bold + settings + + fontStyle + italic bold + + + + name + Markdown code delimiter + scope + punctuation.definition.markdown, punctuation.definition.raw.markdown + settings + + foreground + #dbbc7f + + + + name + Markdown code type + scope + fenced_code.block.language + settings + + foreground + #dbbc7f + + + + name + Markdown code block + scope + markup.fenced_code.block.markdown, markup.inline.raw.string.markdown + settings + + foreground + #a7c080 + + + + name + Markdown list mark + scope + punctuation.definition.list.begin.markdown + settings + + foreground + #e67e80 + + + + name + reStructuredText heading + scope + punctuation.definition.heading.restructuredtext + settings + + foreground + #e69875 + fontStyle + bold + + + + name + reStructuredText delimiter + scope + punctuation.definition.field.restructuredtext, punctuation.separator.key-value.restructuredtext, punctuation.definition.directive.restructuredtext, punctuation.definition.constant.restructuredtext, punctuation.definition.italic.restructuredtext, punctuation.definition.table.restructuredtext + settings + + foreground + #859289 + + + + name + reStructuredText delimiter bold + scope + punctuation.definition.bold.restructuredtext + settings + + foreground + #859289 + fontStyle + regular + + + + name + reStructuredText aqua + scope + entity.name.tag.restructuredtext, punctuation.definition.link.restructuredtext, punctuation.definition.raw.restructuredtext, punctuation.section.raw.restructuredtext + settings + + foreground + #83c092 + + + + name + reStructuredText purple + scope + constant.other.footnote.link.restructuredtext + settings + + foreground + #d699b6 + + + + name + reStructuredText red + scope + support.directive.restructuredtext + settings + + foreground + #e67e80 + + + + name + reStructuredText green + scope + entity.name.directive.restructuredtext, markup.raw.restructuredtext, markup.raw.inner.restructuredtext, string.other.link.title.restructuredtext + settings + + foreground + #a7c080 + + + + name + LaTex delimiter + scope + punctuation.definition.function.latex, punctuation.definition.function.tex, punctuation.definition.keyword.latex, constant.character.newline.tex, punctuation.definition.keyword.tex + settings + + foreground + #859289 + + + + name + LaTex red + scope + support.function.be.latex + settings + + foreground + #e67e80 + + + + name + LaTex orange + scope + support.function.section.latex, keyword.control.table.cell.latex, keyword.control.table.newline.latex + settings + + foreground + #e69875 + + + + name + LaTex yellow + scope + support.class.latex, variable.parameter.latex, variable.parameter.function.latex, variable.parameter.definition.label.latex, constant.other.reference.label.latex + settings + + foreground + #dbbc7f + + + + name + LaTex purple + scope + keyword.control.preamble.latex + settings + + foreground + #d699b6 + + + + name + Html grey + scope + punctuation.separator.namespace.xml + settings + + foreground + #859289 + + + + name + Html orange + scope + entity.name.tag.html, entity.name.tag.xml, entity.name.tag.localname.xml + settings + + foreground + #e69875 + + + + name + Html yellow + scope + entity.other.attribute-name.html, entity.other.attribute-name.xml, entity.other.attribute-name.localname.xml + settings + + foreground + #dbbc7f + + + + name + Html green + scope + string.quoted.double.html, string.quoted.single.html, punctuation.definition.string.begin.html, punctuation.definition.string.end.html, punctuation.separator.key-value.html, punctuation.definition.string.begin.xml, punctuation.definition.string.end.xml, string.quoted.double.xml, string.quoted.single.xml, punctuation.definition.tag.begin.html, punctuation.definition.tag.end.html, punctuation.definition.tag.xml, meta.tag.xml, meta.tag.preprocessor.xml, meta.tag.other.html, meta.tag.block.any.html, meta.tag.inline.any.html + settings + + foreground + #a7c080 + + + + name + Html purple + scope + variable.language.documentroot.xml, meta.tag.sgml.doctype.xml + settings + + foreground + #d699b6 + + + + name + Proto yellow + scope + storage.type.proto + settings + + foreground + #dbbc7f + + + + name + Proto green + scope + string.quoted.double.proto.syntax, string.quoted.single.proto.syntax, string.quoted.double.proto, string.quoted.single.proto + settings + + foreground + #a7c080 + + + + name + Proto aqua + scope + entity.name.class.proto, entity.name.class.message.proto + settings + + foreground + #83c092 + + + + name + CSS grey + scope + punctuation.definition.entity.css, punctuation.separator.key-value.css, punctuation.terminator.rule.css, punctuation.separator.list.comma.css + settings + + foreground + #859289 + + + + name + CSS red + scope + entity.other.attribute-name.class.css + settings + + foreground + #e67e80 + + + + name + CSS orange + scope + keyword.other.unit + settings + + foreground + #e69875 + + + + name + CSS yellow + scope + entity.other.attribute-name.pseudo-class.css, entity.other.attribute-name.pseudo-element.css + settings + + foreground + #dbbc7f + + + + name + CSS green + scope + string.quoted.single.css, string.quoted.double.css, support.constant.property-value.css, meta.property-value.css, punctuation.definition.string.begin.css, punctuation.definition.string.end.css, constant.numeric.css, support.constant.font-name.css, variable.parameter.keyframe-list.css + settings + + foreground + #a7c080 + + + + name + CSS aqua + scope + support.type.property-name.css + settings + + foreground + #83c092 + + + + name + CSS blue + scope + support.type.vendored.property-name.css + settings + + foreground + #7fbbb3 + + + + name + CSS purple + scope + entity.name.tag.css, entity.other.keyframe-offset.css, punctuation.definition.keyword.css, keyword.control.at-rule.keyframes.css, meta.selector.css + settings + + foreground + #d699b6 + + + + name + SASS grey + scope + punctuation.definition.entity.scss, punctuation.separator.key-value.scss, punctuation.terminator.rule.scss, punctuation.separator.list.comma.scss + settings + + foreground + #859289 + + + + name + SASS orange + scope + keyword.control.at-rule.keyframes.scss + settings + + foreground + #e69875 + + + + name + SASS yellow + scope + punctuation.definition.interpolation.begin.bracket.curly.scss, punctuation.definition.interpolation.end.bracket.curly.scss + settings + + foreground + #dbbc7f + + + + name + SASS green + scope + punctuation.definition.string.begin.scss, punctuation.definition.string.end.scss, string.quoted.double.scss, string.quoted.single.scss, constant.character.css.sass, meta.property-value.scss + settings + + foreground + #a7c080 + + + + name + SASS purple + scope + keyword.control.at-rule.include.scss, keyword.control.at-rule.use.scss, keyword.control.at-rule.mixin.scss, keyword.control.at-rule.extend.scss, keyword.control.at-rule.import.scss + settings + + foreground + #d699b6 + + + + name + Stylus white + scope + meta.function.stylus + settings + + foreground + #d3c6aa + + + + name + Stylus yellow + scope + entity.name.function.stylus + settings + + foreground + #dbbc7f + + + + name + JavaScript white + scope + string.unquoted.js + settings + + foreground + #d3c6aa + + + + name + JavaScript grey + scope + punctuation.accessor.js, punctuation.separator.key-value.js, punctuation.separator.label.js, keyword.operator.accessor.js + settings + + foreground + #859289 + + + + name + JavaScript red + scope + punctuation.definition.block.tag.jsdoc + settings + + foreground + #e67e80 + + + + name + JavaScript orange + scope + storage.type.js, storage.type.function.arrow.js + settings + + foreground + #e69875 + + + + name + JSX white + scope + JSXNested + settings + + foreground + #d3c6aa + + + + name + JSX green + scope + punctuation.definition.tag.jsx, entity.other.attribute-name.jsx, punctuation.definition.tag.begin.js.jsx, punctuation.definition.tag.end.js.jsx, entity.other.attribute-name.js.jsx + settings + + foreground + #a7c080 + + + + name + TypeScript white + scope + entity.name.type.module.ts + settings + + foreground + #d3c6aa + + + + name + TypeScript grey + scope + keyword.operator.type.annotation.ts, punctuation.accessor.ts, punctuation.separator.key-value.ts + settings + + foreground + #859289 + + + + name + TypeScript green + scope + punctuation.definition.tag.directive.ts, entity.other.attribute-name.directive.ts + settings + + foreground + #a7c080 + + + + name + TypeScript aqua + scope + entity.name.type.ts, entity.name.type.interface.ts, entity.other.inherited-class.ts, entity.name.type.alias.ts, entity.name.type.class.ts, entity.name.type.enum.ts + settings + + foreground + #83c092 + + + + name + TypeScript orange + scope + storage.type.ts, storage.type.function.arrow.ts, storage.type.type.ts + settings + + foreground + #e69875 + + + + name + TypeScript blue + scope + entity.name.type.module.ts + settings + + foreground + #7fbbb3 + + + + name + TypeScript purple + scope + keyword.control.import.ts, keyword.control.export.ts, storage.type.namespace.ts + settings + + foreground + #d699b6 + + + + name + TSX white + scope + entity.name.type.module.tsx + settings + + foreground + #d3c6aa + + + + name + TSX grey + scope + keyword.operator.type.annotation.tsx, punctuation.accessor.tsx, punctuation.separator.key-value.tsx + settings + + foreground + #859289 + + + + name + TSX green + scope + punctuation.definition.tag.directive.tsx, entity.other.attribute-name.directive.tsx, punctuation.definition.tag.begin.tsx, punctuation.definition.tag.end.tsx, entity.other.attribute-name.tsx + settings + + foreground + #a7c080 + + + + name + TSX aqua + scope + entity.name.type.tsx, entity.name.type.interface.tsx, entity.other.inherited-class.tsx, entity.name.type.alias.tsx, entity.name.type.class.tsx, entity.name.type.enum.tsx + settings + + foreground + #83c092 + + + + name + TSX blue + scope + entity.name.type.module.tsx + settings + + foreground + #7fbbb3 + + + + name + TSX purple + scope + keyword.control.import.tsx, keyword.control.export.tsx, storage.type.namespace.tsx + settings + + foreground + #d699b6 + + + + name + TSX orange + scope + storage.type.tsx, storage.type.function.arrow.tsx, storage.type.type.tsx, support.class.component.tsx + settings + + foreground + #e69875 + + + + name + CoffeeScript orange + scope + storage.type.function.coffee + settings + + foreground + #e69875 + + + + name + PureScript white + scope + meta.type-signature.purescript + settings + + foreground + #d3c6aa + + + + name + PureScript orange + scope + keyword.other.double-colon.purescript, keyword.other.arrow.purescript, keyword.other.big-arrow.purescript + settings + + foreground + #e69875 + + + + name + PureScript yellow + scope + entity.name.function.purescript + settings + + foreground + #dbbc7f + + + + name + PureScript green + scope + string.quoted.single.purescript, string.quoted.double.purescript, punctuation.definition.string.begin.purescript, punctuation.definition.string.end.purescript, string.quoted.triple.purescript, entity.name.type.purescript + settings + + foreground + #a7c080 + + + + name + PureScript purple + scope + support.other.module.purescript + settings + + foreground + #d699b6 + + + + name + Dart grey + scope + punctuation.dot.dart + settings + + foreground + #859289 + + + + name + Dart orange + scope + storage.type.primitive.dart + settings + + foreground + #e69875 + + + + name + Dart yellow + scope + support.class.dart + settings + + foreground + #dbbc7f + + + + name + Dart green + scope + entity.name.function.dart, string.interpolated.single.dart, string.interpolated.double.dart + settings + + foreground + #a7c080 + + + + name + Dart blue + scope + variable.language.dart + settings + + foreground + #7fbbb3 + + + + name + Dart purple + scope + keyword.other.import.dart, storage.type.annotation.dart + settings + + foreground + #d699b6 + + + + name + Pug red + scope + entity.other.attribute-name.class.pug + settings + + foreground + #e67e80 + + + + name + Pug orange + scope + storage.type.function.pug + settings + + foreground + #e69875 + + + + name + Pug aqua + scope + entity.other.attribute-name.tag.pug + settings + + foreground + #83c092 + + + + name + Pug purple + scope + entity.name.tag.pug, storage.type.import.include.pug + settings + + foreground + #d699b6 + + + + name + C white + scope + meta.function-call.c, storage.modifier.array.bracket.square.c, meta.function.definition.parameters.c + settings + + foreground + #d3c6aa + + + + name + C grey + scope + punctuation.separator.dot-access.c, constant.character.escape.line-continuation.c + settings + + foreground + #859289 + + + + name + C red + scope + keyword.control.directive.include.c, punctuation.definition.directive.c, keyword.control.directive.pragma.c, keyword.control.directive.line.c, keyword.control.directive.define.c, keyword.control.directive.conditional.c, keyword.control.directive.diagnostic.error.c, keyword.control.directive.undef.c, keyword.control.directive.conditional.ifdef.c, keyword.control.directive.endif.c, keyword.control.directive.conditional.ifndef.c, keyword.control.directive.conditional.if.c, keyword.control.directive.else.c + settings + + foreground + #e67e80 + + + + name + C orange + scope + punctuation.separator.pointer-access.c + settings + + foreground + #e69875 + + + + name + C aqua + scope + variable.other.member.c + settings + + foreground + #83c092 + + + + name + C++ white + scope + meta.function-call.cpp, storage.modifier.array.bracket.square.cpp, meta.function.definition.parameters.cpp, meta.body.function.definition.cpp + settings + + foreground + #d3c6aa + + + + name + C++ grey + scope + punctuation.separator.dot-access.cpp, constant.character.escape.line-continuation.cpp + settings + + foreground + #859289 + + + + name + C++ red + scope + keyword.control.directive.include.cpp, punctuation.definition.directive.cpp, keyword.control.directive.pragma.cpp, keyword.control.directive.line.cpp, keyword.control.directive.define.cpp, keyword.control.directive.conditional.cpp, keyword.control.directive.diagnostic.error.cpp, keyword.control.directive.undef.cpp, keyword.control.directive.conditional.ifdef.cpp, keyword.control.directive.endif.cpp, keyword.control.directive.conditional.ifndef.cpp, keyword.control.directive.conditional.if.cpp, keyword.control.directive.else.cpp, storage.type.namespace.definition.cpp, keyword.other.using.directive.cpp, storage.type.struct.cpp + settings + + foreground + #e67e80 + + + + name + C++ orange + scope + punctuation.separator.pointer-access.cpp, punctuation.section.angle-brackets.begin.template.call.cpp, punctuation.section.angle-brackets.end.template.call.cpp + settings + + foreground + #e69875 + + + + name + C++ aqua + scope + variable.other.member.cpp + settings + + foreground + #83c092 + + + + name + C# red + scope + keyword.other.using.cs + settings + + foreground + #e67e80 + + + + name + C# yellow + scope + keyword.type.cs, constant.character.escape.cs, punctuation.definition.interpolation.begin.cs, punctuation.definition.interpolation.end.cs + settings + + foreground + #dbbc7f + + + + name + C# green + scope + string.quoted.double.cs, string.quoted.single.cs, punctuation.definition.string.begin.cs, punctuation.definition.string.end.cs + settings + + foreground + #a7c080 + + + + name + C# aqua + scope + variable.other.object.property.cs + settings + + foreground + #83c092 + + + + name + C# purple + scope + entity.name.type.namespace.cs + settings + + foreground + #d699b6 + + + + name + F# white + scope + keyword.symbol.fsharp, constant.language.unit.fsharp + settings + + foreground + #d3c6aa + + + + name + F# yellow + scope + keyword.format.specifier.fsharp, entity.name.type.fsharp + settings + + foreground + #dbbc7f + + + + name + F# green + scope + string.quoted.double.fsharp, string.quoted.single.fsharp, punctuation.definition.string.begin.fsharp, punctuation.definition.string.end.fsharp + settings + + foreground + #a7c080 + + + + name + F# blue + scope + entity.name.section.fsharp + settings + + foreground + #7fbbb3 + + + + name + F# purple + scope + support.function.attribute.fsharp + settings + + foreground + #d699b6 + + + + name + Java grey + scope + punctuation.separator.java, punctuation.separator.period.java + settings + + foreground + #859289 + + + + name + Java red + scope + keyword.other.import.java, keyword.other.package.java + settings + + foreground + #e67e80 + + + + name + Java orange + scope + storage.type.function.arrow.java, keyword.control.ternary.java + settings + + foreground + #e69875 + + + + name + Java aqua + scope + variable.other.property.java + settings + + foreground + #83c092 + + + + name + Java purple + scope + variable.language.wildcard.java, storage.modifier.import.java, storage.type.annotation.java, punctuation.definition.annotation.java, storage.modifier.package.java, entity.name.type.module.java + settings + + foreground + #d699b6 + + + + name + Kotlin red + scope + keyword.other.import.kotlin + settings + + foreground + #e67e80 + + + + name + Kotlin orange + scope + storage.type.kotlin + settings + + foreground + #e69875 + + + + name + Kotlin aqua + scope + constant.language.kotlin + settings + + foreground + #83c092 + + + + name + Kotlin purple + scope + entity.name.package.kotlin, storage.type.annotation.kotlin + settings + + foreground + #d699b6 + + + + name + Scala purple + scope + entity.name.package.scala + settings + + foreground + #d699b6 + + + + name + Scala blue + scope + constant.language.scala + settings + + foreground + #7fbbb3 + + + + name + Scala aqua + scope + entity.name.import.scala + settings + + foreground + #83c092 + + + + name + Scala green + scope + string.quoted.double.scala, string.quoted.single.scala, punctuation.definition.string.begin.scala, punctuation.definition.string.end.scala, string.quoted.double.interpolated.scala, string.quoted.single.interpolated.scala, string.quoted.triple.scala + settings + + foreground + #a7c080 + + + + name + Scala yellow + scope + entity.name.class, entity.other.inherited-class.scala + settings + + foreground + #dbbc7f + + + + name + Scala orange + scope + keyword.declaration.stable.scala, keyword.other.arrow.scala + settings + + foreground + #e69875 + + + + name + Scala red + scope + keyword.other.import.scala + settings + + foreground + #e67e80 + + + + name + Groovy white + scope + keyword.operator.navigation.groovy, meta.method.body.java, meta.definition.method.groovy, meta.definition.method.signature.java + settings + + foreground + #d3c6aa + + + + name + Scala grey + scope + punctuation.separator.groovy + settings + + foreground + #859289 + + + + name + Scala red + scope + keyword.other.import.groovy, keyword.other.package.groovy, keyword.other.import.static.groovy + settings + + foreground + #e67e80 + + + + name + Groovy orange + scope + storage.type.def.groovy + settings + + foreground + #e69875 + + + + name + Groovy green + scope + variable.other.interpolated.groovy, meta.method.groovy + settings + + foreground + #a7c080 + + + + name + Groovy aqua + scope + storage.modifier.import.groovy, storage.modifier.package.groovy + settings + + foreground + #83c092 + + + + name + Groovy purple + scope + storage.type.annotation.groovy + settings + + foreground + #d699b6 + + + + name + Go red + scope + keyword.type.go + settings + + foreground + #e67e80 + + + + name + Go aqua + scope + entity.name.package.go + settings + + foreground + #83c092 + + + + name + Go purple + scope + keyword.import.go, keyword.package.go + settings + + foreground + #d699b6 + + + + name + Rust white + scope + entity.name.type.mod.rust + settings + + foreground + #d3c6aa + + + + name + Rust grey + scope + keyword.operator.path.rust, keyword.operator.member-access.rust + settings + + foreground + #859289 + + + + name + Rust orange + scope + storage.type.rust + settings + + foreground + #e69875 + + + + name + Rust aqua + scope + support.constant.core.rust + settings + + foreground + #83c092 + + + + name + Rust purple + scope + meta.attribute.rust, variable.language.rust, storage.type.module.rust + settings + + foreground + #d699b6 + + + + name + Swift white + scope + meta.function-call.swift, support.function.any-method.swift + settings + + foreground + #d3c6aa + + + + name + Swift aqua + scope + support.variable.swift + settings + + foreground + #83c092 + + + + name + PHP white + scope + keyword.operator.class.php + settings + + foreground + #d3c6aa + + + + name + PHP orange + scope + storage.type.trait.php + settings + + foreground + #e69875 + + + + name + PHP aqua + scope + constant.language.php, support.other.namespace.php + settings + + foreground + #83c092 + + + + name + PHP blue + scope + storage.type.modifier.access.control.public.cpp, storage.type.modifier.access.control.private.cpp + settings + + foreground + #7fbbb3 + + + + name + PHP purple + scope + keyword.control.import.include.php, storage.type.php + settings + + foreground + #d699b6 + + + + name + Python white + scope + meta.function-call.arguments.python + settings + + foreground + #d3c6aa + + + + name + Python grey + scope + punctuation.definition.decorator.python, punctuation.separator.period.python + settings + + foreground + #859289 + + + + name + Python aqua + scope + constant.language.python + settings + + foreground + #83c092 + + + + name + Python purple + scope + keyword.control.import.python, keyword.control.import.from.python + settings + + foreground + #d699b6 + + + + name + Lua aqua + scope + constant.language.lua + settings + + foreground + #83c092 + + + + name + Lua blue + scope + entity.name.class.lua + settings + + foreground + #7fbbb3 + + + + name + Ruby white + scope + meta.function.method.with-arguments.ruby + settings + + foreground + #d3c6aa + + + + name + Ruby grey + scope + punctuation.separator.method.ruby + settings + + foreground + #859289 + + + + name + Ruby orange + scope + keyword.control.pseudo-method.ruby, storage.type.variable.ruby + settings + + foreground + #e69875 + + + + name + Ruby green + scope + keyword.other.special-method.ruby + settings + + foreground + #a7c080 + + + + name + Ruby purple + scope + keyword.control.module.ruby, punctuation.definition.constant.ruby + settings + + foreground + #d699b6 + + + + name + Ruby yellow + scope + string.regexp.character-class.ruby,string.regexp.interpolated.ruby,punctuation.definition.character-class.ruby,string.regexp.group.ruby, punctuation.section.regexp.ruby, punctuation.definition.group.ruby + settings + + foreground + #dbbc7f + + + + name + Ruby blue + scope + variable.other.constant.ruby + settings + + foreground + #7fbbb3 + + + + name + Haskell orange + scope + keyword.other.arrow.haskell, keyword.other.big-arrow.haskell, keyword.other.double-colon.haskell + settings + + foreground + #e69875 + + + + name + Haskell yellow + scope + storage.type.haskell + settings + + foreground + #dbbc7f + + + + name + Haskell green + scope + constant.other.haskell, string.quoted.double.haskell, string.quoted.single.haskell, punctuation.definition.string.begin.haskell, punctuation.definition.string.end.haskell + settings + + foreground + #a7c080 + + + + name + Haskell blue + scope + entity.name.function.haskell + settings + + foreground + #7fbbb3 + + + + name + Haskell aqua + scope + entity.name.namespace, meta.preprocessor.haskell + settings + + foreground + #83c092 + + + + name + Julia red + scope + keyword.control.import.julia, keyword.control.export.julia + settings + + foreground + #e67e80 + + + + name + Julia orange + scope + keyword.storage.modifier.julia + settings + + foreground + #e69875 + + + + name + Julia aqua + scope + constant.language.julia + settings + + foreground + #83c092 + + + + name + Julia purple + scope + support.function.macro.julia + settings + + foreground + #d699b6 + + + + name + Elm white + scope + keyword.other.period.elm + settings + + foreground + #d3c6aa + + + + name + Elm yellow + scope + storage.type.elm + settings + + foreground + #dbbc7f + + + + name + R orange + scope + keyword.other.r + settings + + foreground + #e69875 + + + + name + R green + scope + entity.name.function.r, variable.function.r + settings + + foreground + #a7c080 + + + + name + R aqua + scope + constant.language.r + settings + + foreground + #83c092 + + + + name + R purple + scope + entity.namespace.r + settings + + foreground + #d699b6 + + + + name + Erlang grey + scope + punctuation.separator.module-function.erlang, punctuation.section.directive.begin.erlang + settings + + foreground + #859289 + + + + name + Erlang red + scope + keyword.control.directive.erlang, keyword.control.directive.define.erlang + settings + + foreground + #e67e80 + + + + name + Erlang yellow + scope + entity.name.type.class.module.erlang + settings + + foreground + #dbbc7f + + + + name + Erlang green + scope + string.quoted.double.erlang, string.quoted.single.erlang, punctuation.definition.string.begin.erlang, punctuation.definition.string.end.erlang + settings + + foreground + #a7c080 + + + + name + Erlang purple + scope + keyword.control.directive.export.erlang, keyword.control.directive.module.erlang, keyword.control.directive.import.erlang, keyword.control.directive.behaviour.erlang + settings + + foreground + #d699b6 + + + + name + Elixir aqua + scope + variable.other.readwrite.module.elixir, punctuation.definition.variable.elixir + settings + + foreground + #83c092 + + + + name + Elixir blue + scope + constant.language.elixir + settings + + foreground + #7fbbb3 + + + + name + Elixir purple + scope + keyword.control.module.elixir + settings + + foreground + #d699b6 + + + + name + OCaml white + scope + entity.name.type.value-signature.ocaml + settings + + foreground + #d3c6aa + + + + name + OCaml orange + scope + keyword.other.ocaml + settings + + foreground + #e69875 + + + + name + OCaml aqua + scope + constant.language.variant.ocaml + settings + + foreground + #83c092 + + + + name + Perl red + scope + storage.type.sub.perl, storage.type.declare.routine.perl + settings + + foreground + #e67e80 + + + + name + Lisp white + scope + meta.function.lisp + settings + + foreground + #d3c6aa + + + + name + Lisp red + scope + storage.type.function-type.lisp + settings + + foreground + #e67e80 + + + + name + Lisp green + scope + keyword.constant.lisp + settings + + foreground + #a7c080 + + + + name + Lisp aqua + scope + entity.name.function.lisp + settings + + foreground + #83c092 + + + + name + Clojure green + scope + constant.keyword.clojure, support.variable.clojure, meta.definition.variable.clojure + settings + + foreground + #a7c080 + + + + name + Clojure purple + scope + entity.global.clojure + settings + + foreground + #d699b6 + + + + name + Clojure blue + scope + entity.name.function.clojure + settings + + foreground + #7fbbb3 + + + + name + Shell white + scope + meta.scope.if-block.shell, meta.scope.group.shell + settings + + foreground + #d3c6aa + + + + name + Shell yellow + scope + support.function.builtin.shell, entity.name.function.shell + settings + + foreground + #dbbc7f + + + + name + Shell green + scope + string.quoted.double.shell, string.quoted.single.shell, punctuation.definition.string.begin.shell, punctuation.definition.string.end.shell, string.unquoted.heredoc.shell + settings + + foreground + #a7c080 + + + + name + Shell purple + scope + keyword.control.heredoc-token.shell, variable.other.normal.shell, punctuation.definition.variable.shell, variable.other.special.shell, variable.other.positional.shell, variable.other.bracket.shell + settings + + foreground + #d699b6 + + + + name + Fish red + scope + support.function.builtin.fish + settings + + foreground + #e67e80 + + + + name + Fish orange + scope + support.function.unix.fish + settings + + foreground + #e69875 + + + + name + Fish blue + scope + variable.other.normal.fish, punctuation.definition.variable.fish, variable.other.fixed.fish, variable.other.special.fish + settings + + foreground + #7fbbb3 + + + + name + Fish green + scope + string.quoted.double.fish, punctuation.definition.string.end.fish, punctuation.definition.string.begin.fish, string.quoted.single.fish + settings + + foreground + #a7c080 + + + + name + Fish purple + scope + constant.character.escape.single.fish + settings + + foreground + #d699b6 + + + + name + PowerShell grey + scope + punctuation.definition.variable.powershell + settings + + foreground + #859289 + + + + name + PowerShell yellow + scope + entity.name.function.powershell, support.function.attribute.powershell, support.function.powershell + settings + + foreground + #dbbc7f + + + + name + PowerShell green + scope + string.quoted.single.powershell, string.quoted.double.powershell, punctuation.definition.string.begin.powershell, punctuation.definition.string.end.powershell, string.quoted.double.heredoc.powershell + settings + + foreground + #a7c080 + + + + name + PowerShell aqua + scope + variable.other.member.powershell + settings + + foreground + #83c092 + + + + name + GraphQL white + scope + string.unquoted.alias.graphql + settings + + foreground + #d3c6aa + + + + name + GraphQL red + scope + keyword.type.graphql + settings + + foreground + #e67e80 + + + + name + GraphQL purple + scope + entity.name.fragment.graphql + settings + + foreground + #d699b6 + + + + name + Makefile orange + scope + entity.name.function.target.makefile + settings + + foreground + #e69875 + + + + name + Makefile yellow + scope + variable.other.makefile + settings + + foreground + #dbbc7f + + + + name + Makefile green + scope + meta.scope.prerequisites.makefile + settings + + foreground + #a7c080 + + + + name + CMake green + scope + string.source.cmake + settings + + foreground + #a7c080 + + + + name + CMake aqua + scope + entity.source.cmake + settings + + foreground + #83c092 + + + + name + CMake purple + scope + storage.source.cmake + settings + + foreground + #d699b6 + + + + name + VimL grey + scope + punctuation.definition.map.viml + settings + + foreground + #859289 + + + + name + VimL orange + scope + storage.type.map.viml + settings + + foreground + #e69875 + + + + name + VimL green + scope + constant.character.map.viml, constant.character.map.key.viml + settings + + foreground + #a7c080 + + + + name + VimL blue + scope + constant.character.map.special.viml + settings + + foreground + #7fbbb3 + + + + name + Tmux green + scope + constant.language.tmux, constant.numeric.tmux + settings + + foreground + #a7c080 + + + + name + Dockerfile orange + scope + entity.name.function.package-manager.dockerfile + settings + + foreground + #e69875 + + + + name + Dockerfile yellow + scope + keyword.operator.flag.dockerfile + settings + + foreground + #dbbc7f + + + + name + Dockerfile green + scope + string.quoted.double.dockerfile, string.quoted.single.dockerfile + settings + + foreground + #a7c080 + + + + name + Dockerfile aqua + scope + constant.character.escape.dockerfile + settings + + foreground + #83c092 + + + + name + Dockerfile purple + scope + entity.name.type.base-image.dockerfile, entity.name.image.dockerfile + settings + + foreground + #d699b6 + + + + name + Diff grey + scope + punctuation.definition.separator.diff + settings + + foreground + #859289 + + + + name + Diff red + scope + markup.deleted.diff, punctuation.definition.deleted.diff + settings + + foreground + #e67e80 + + + + name + Diff orange + scope + meta.diff.range.context, punctuation.definition.range.diff + settings + + foreground + #e69875 + + + + name + Diff yellow + scope + meta.diff.header.from-file + settings + + foreground + #dbbc7f + + + + name + Diff green + scope + markup.inserted.diff, punctuation.definition.inserted.diff + settings + + foreground + #a7c080 + + + + name + Diff blue + scope + markup.changed.diff, punctuation.definition.changed.diff + settings + + foreground + #7fbbb3 + + + + name + Diff purple + scope + punctuation.definition.from-file.diff + settings + + foreground + #d699b6 + + + + name + Git red + scope + entity.name.section.group-title.ini, punctuation.definition.entity.ini + settings + + foreground + #e67e80 + + + + name + Git orange + scope + punctuation.separator.key-value.ini + settings + + foreground + #e69875 + + + + name + Git green + scope + string.quoted.double.ini, string.quoted.single.ini, punctuation.definition.string.begin.ini, punctuation.definition.string.end.ini + settings + + foreground + #a7c080 + + + + name + Git aqua + scope + keyword.other.definition.ini + settings + + foreground + #83c092 + + + + name + SQL yellow + scope + support.function.aggregate.sql + settings + + foreground + #dbbc7f + + + + name + SQL green + scope + string.quoted.single.sql, punctuation.definition.string.end.sql, punctuation.definition.string.begin.sql, string.quoted.double.sql + settings + + foreground + #a7c080 + + + + name + GraphQL yellow + scope + support.type.graphql + settings + + foreground + #dbbc7f + + + + name + GraphQL blue + scope + variable.parameter.graphql + settings + + foreground + #7fbbb3 + + + + name + GraphQL aqua + scope + constant.character.enum.graphql + settings + + foreground + #83c092 + + + + name + JSON grey + scope + punctuation.support.type.property-name.begin.json, punctuation.support.type.property-name.end.json, punctuation.separator.dictionary.key-value.json, punctuation.definition.string.begin.json, punctuation.definition.string.end.json, punctuation.separator.dictionary.pair.json, punctuation.separator.array.json + settings + + foreground + #859289 + + + + name + JSON orange + scope + support.type.property-name.json + settings + + foreground + #e69875 + + + + name + JSON green + scope + string.quoted.double.json + settings + + foreground + #a7c080 + + + + name + YAML grey + scope + punctuation.separator.key-value.mapping.yaml + settings + + foreground + #859289 + + + + name + YAML green + scope + string.unquoted.plain.out.yaml, string.quoted.single.yaml, string.quoted.double.yaml, punctuation.definition.string.begin.yaml, punctuation.definition.string.end.yaml, string.unquoted.plain.in.yaml, string.unquoted.block.yaml + settings + + foreground + #a7c080 + + + + name + YAML aqua + scope + punctuation.definition.anchor.yaml, punctuation.definition.block.sequence.item.yaml + settings + + foreground + #83c092 + + + + name + TOML orange + scope + keyword.key.toml + settings + + foreground + #e69875 + + + + name + TOML green + scope + string.quoted.single.basic.line.toml, string.quoted.single.literal.line.toml, punctuation.definition.keyValuePair.toml + settings + + foreground + #a7c080 + + + + name + TOML blue + scope + constant.other.boolean.toml + settings + + foreground + #7fbbb3 + + + + name + TOML purple + scope + entity.other.attribute-name.table.toml, punctuation.definition.table.toml, entity.other.attribute-name.table.array.toml, punctuation.definition.table.array.toml + settings + + foreground + #d699b6 + + + + name + Comment + scope + comment, string.comment, punctuation.definition.comment + settings + + foreground + #859289 + fontStyle + italic + + + + uuid + 3f688e48-bd62-4cd7-9981-9b491786d8c6 + colorSpaceName + sRGB + semanticClass + theme.dark.everforest-dark + author + + comment + + + \ No newline at end of file diff --git a/sass/style.scss b/sass/style.scss index 4f1c85f..3131fed 100644 --- a/sass/style.scss +++ b/sass/style.scss @@ -25,7 +25,7 @@ body { color: everforest.$fg; - background-color: everforest.$bg0; + background-color: everforest.$bg1; } a { @@ -37,6 +37,10 @@ img { max-height: 720px; } +pre { + padding: 5px; +} + .wip-indicator { color: everforest.$yellow; } diff --git a/syntaxes/wgsl.sublime-syntax b/syntaxes/wgsl.sublime-syntax new file mode 100644 index 0000000..2b81f3e --- /dev/null +++ b/syntaxes/wgsl.sublime-syntax @@ -0,0 +1,215 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/syntax.html +name: WGSL +file_extensions: [wgsl] +scope: source.wgsl +contexts: + main: + - include: line_comments + - include: block_comments + - include: constants + - include: keywords + - include: attributes + - include: functions + - include: function_calls + - include: types + - include: variables + - include: punctuation + attributes: + # attribute declaration + - match: '(@)([A-Za-z_]+)' + scope: meta.attribute.wgsl + captures: + 1: keyword.operator.attribute.at + 2: entity.name.attribute.wgsl + block_comments: + # empty block comments + - match: /\*\*/ + scope: comment.block.wgsl + # block documentation comments + - match: /\*\* + push: + - meta_scope: comment.block.documentation.wgsl + - match: \*/ + pop: true + - include: block_comments + # block comments + - match: /\*(?!\*) + push: + - meta_scope: comment.block.wgsl + - match: \*/ + pop: true + - include: block_comments + constants: + # boolean constant + - match: \b(true|false)\b + scope: constant.language.boolean.wgsl + # decimal float literal + - match: '(\b(0|[1-9][0-9]*)[fh]\b|([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)([eE][+-]?[0-9]+)?[fh]?|[0-9]+[eE][+-]?[0-9]+[fh]?)' + scope: constant.numeric.float.wgsl + # decimal int literal + - match: '\b(0|[1-9][0-9]*)[iu]?\b' + scope: constant.numeric.decimal.wgsl + # hexadecimal int literal + - match: '\b0[xX][0-9a-fA-F]+[iu]?\b' + scope: constant.numeric.decimal.wgsl + function_calls: + # function/method calls + - match: '([A-Za-z0-9_]+)(\()' + captures: + 1: entity.name.function.wgsl + 2: punctuation.brackets.round.wgsl + push: + - meta_scope: meta.function.call.wgsl + - match: \) + captures: + 0: punctuation.brackets.round.wgsl + pop: true + - include: line_comments + - include: block_comments + - include: constants + - include: keywords + - include: attributes + - include: function_calls + - include: types + - include: variables + - include: punctuation + functions: + # function definition + - match: '\b(fn)\s+([A-Za-z0-9_]+)((\()|(<))' + captures: + 1: keyword.other.fn.wgsl + 2: entity.name.function.wgsl + 4: punctuation.brackets.round.wgsl + push: + - meta_scope: meta.function.definition.wgsl + - match: '\{' + captures: + 0: punctuation.brackets.curly.wgsl + pop: true + - include: line_comments + - include: block_comments + - include: constants + - include: keywords + - include: attributes + - include: function_calls + - include: types + - include: variables + - include: punctuation + keywords: + # other keywords + - match: \b(bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|override|private|read|read_write|return|storage|switch|uniform|while|workgroup|write)\b + scope: keyword.control.wgsl + # reserved keywords + - match: \b(asm|const|do|enum|handle|mat|premerge|regardless|typedef|unless|using|vec|void)\b + scope: keyword.control.wgsl + # storage keywords + - match: \b(let|var)\b + scope: keyword.other.wgsl storage.type.wgsl + # type keyword + - match: \b(type)\b + scope: keyword.declaration.type.wgsl storage.type.wgsl + # enum keyword + - match: \b(enum)\b + scope: keyword.declaration.enum.wgsl storage.type.wgsl + # struct keyword + - match: \b(struct)\b + scope: keyword.declaration.struct.wgsl storage.type.wgsl + # fn + - match: \bfn\b + scope: keyword.other.fn.wgsl + # logical operators + - match: (\^|\||\|\||&&|<<|>>|!)(?!=) + scope: keyword.operator.logical.wgsl + # logical AND, borrow references + - match: '&(?![&=])' + scope: keyword.operator.borrow.and.wgsl + # assignment operators + - match: (\+=|-=|\*=|/=|%=|\^=|&=|\|=|<<=|>>=) + scope: keyword.operator.assignment.wgsl + # single equal + - match: '(?])=(?!=|>)' + scope: keyword.operator.assignment.equal.wgsl + # comparison operators + - match: (=(=)?(?!>)|!=|<=|(?=) + scope: keyword.operator.comparison.wgsl + # math operators + - match: '(([+%]|(\*(?!\w)))(?!=))|(-(?!>))|(/(?!/))' + scope: keyword.operator.math.wgsl + # dot access + - match: \.(?!\.) + scope: keyword.operator.access.dot.wgsl + # dashrocket, skinny arrow + - match: '->' + scope: keyword.operator.arrow.skinny.wgsl + line_comments: + # single line comment + - match: \s*//.* + scope: comment.line.double-slash.wgsl + punctuation: + # comma + - match: ',' + scope: punctuation.comma.wgsl + # curly braces + - match: '[{}]' + scope: punctuation.brackets.curly.wgsl + # parentheses, round brackets + - match: '[()]' + scope: punctuation.brackets.round.wgsl + # semicolon + - match: ; + scope: punctuation.semi.wgsl + # square brackets + - match: '[\[\]]' + scope: punctuation.brackets.square.wgsl + # angle brackets + - match: '(?]' + scope: punctuation.brackets.angle.wgsl + types: + # scalar types + - match: \b(bool|i32|u32|f16|f32)\b + scope: storage.type.wgsl + # reserved scalar types + - match: \b(i64|u64|f64)\b + scope: storage.type.wgsl + # vector type aliasses + - match: \b(vec2i|vec3i|vec4i|vec2u|vec3u|vec4u|vec2f|vec3f|vec4f|vec2h|vec3h|vec4h)\b + scope: storage.type.wgsl + # matrix type aliasses + - match: \b(mat2x2f|mat2x3f|mat2x4f|mat3x2f|mat3x3f|mat3x4f|mat4x2f|mat4x3f|mat4x4f|mat2x2h|mat2x3h|mat2x4h|mat3x2h|mat3x3h|mat3x4h|mat4x2h|mat4x3h|mat4x4h)\b + scope: storage.type.wgsl + # vector/matrix types + - match: '\b(vec[2-4]|mat[2-4]x[2-4])\b' + scope: storage.type.wgsl + # atomic types + - match: \b(atomic)\b + scope: storage.type.wgsl + # array types + - match: \b(array)\b + scope: storage.type.wgsl + # sampled texture types + - match: \b(texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array)\b + scope: storage.type.wgsl + # multisampled texture types + - match: \b(texture_multisampled_2d|texture_depth_multisampled_2d)\b + scope: storage.type.wgsl + # external sampled texture types + - match: \b(texture_external)\b + scope: storage.type.wgsl + # storage texture types + - match: \b(texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d)\b + scope: storage.type.wgsl + # depth texture types + - match: \b(texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array)\b + scope: storage.type.wgsl + # sampler type + - match: \b(sampler|sampler_comparison)\b + scope: storage.type.wgsl + # custom type + - match: '\b([A-Z][A-Za-z0-9]*)\b' + scope: entity.name.type.wgsl + variables: + # variables + - match: '\b(?