Visually distinguish the three sections of a .svelte file — <script>, <style>, and markup — by giving each a distinct background color directly in your editor.
<script> blocks with a configurable background (default: warm amber tint).<style> blocks with a configurable background (default: cool blue tint)..svelte file — no commands needed.1.85.0 or newer.All colors can be changed via Settings → Extensions → Svelte Section Highlighter, or directly in settings.json:
| Setting | Default | Description |
|---|---|---|
svelteSectionHighlighter.scriptBackground |
#FFC8001F |
Background for <script> sections |
svelteSectionHighlighter.styleBackground |
#00C8FF1F |
Background for <style> sections |
svelteSectionHighlighter.markupBackground |
#0000000F |
Background for markup sections |
Colors support hex (#RRGGBB, #RRGGBBAA, #RGB), rgb(), rgba(), and hsl() formats. The VS Code color picker is available directly in settings for hex values.
Example (settings.json):
"svelteSectionHighlighter.scriptBackground": "#ffff0010",
"svelteSectionHighlighter.markupBackground": "#ff000010"
"svelteSectionHighlighter.styleBackground": "#0000ff10",
CC BY-NC-ND 4.0 — free to use for non-commercial purposes; no modifications or redistribution.