How Islands Dark Theme Handles Python and Rust Syntax Tokens in VS Code
Islands Dark assigns specific hex color codes to TextMate scope selectors in themes/islands-dark.json, using muted yellow-orange for Python decorators and Rust attributes, bright blue for magic methods and macros, and cyan-green for Rust lifetimes.
Islands Dark is a VS Code color theme that provides language-specific syntax highlighting for Python and Rust through targeted scope mappings. Rather than shipping custom parsers, it leverages the standard tokenColors and semanticTokenColors sections of a theme JSON file to assign visual styles to language-specific tokens. The theme definitions reside in themes/islands-dark.json, where precise TextMate scope selectors map to curated color values between lines 921 and 997.
Python Token Handling
The theme distinguishes three critical Python constructs by targeting scopes generated by VS Code's built-in Python grammar.
Decorators and Dunder Methods
Islands Dark applies a muted yellow-orange (#bbb529) to Python function decorators by matching both meta.function.decorator.python and entity.name.function.decorator.python scopes. This captures decorators like @dataclass and @property.
For magic methods (dunder methods like __init__ and __repr__), the theme targets support.function.magic.python with a bright blue (#56a8f5). This visually distinguishes special methods from standard functions while maintaining consistency with other function coloring in the palette.
F-String Placeholders
To make formatted string literals readable, Islands Dark applies a warm orange (#cf8e6d) to the scope constant.character.format.placeholder.other.python. This highlights the brace placeholders ({value}) inside f-strings, making interpolation points immediately visible.
# example.py
from dataclasses import dataclass
@dataclass # ← decorator (shown in #bbb529)
class Point:
x: int
y: int
def __repr__(self): # ← magic method (shown in #56a8f5)
return f"Point(x={self.x}, y={self.y})" # ← f-string braces (shown in #cf8e6d)
Rust Token Handling
For Rust, Islands Dark provides distinct highlighting for lifetimes, macros, and attributes, ensuring systems programming constructs stand out.
Lifetimes and Attributes
Lifetime identifiers ('a, 'static) receive a cyan-green treatment (#2aacb8) through multiple scope matches: entity.name.type.lifetime.rust, storage.modifier.lifetime.rust, and punctuation.definition.lifetime.rust. Attribute annotations (like #[derive(Debug)]) use the same muted yellow-orange (#bbb529) as Python decorators by targeting meta.attribute.rust.
Macro Definitions and Calls
Macro invocations (println!, vec!) and definitions appear in bright blue (#56a8f5) with bold weight. The theme applies this style to entity.name.function.macro.rust and support.macro.rust scopes, making macro syntax distinct from standard function calls.
// example.rs
#[derive(Debug)] // ← attribute (shown in #bbb529)
struct Point<'a> { // ← lifetime (shown in #2aacb8)
x: &'a i32,
y: &'a i32,
}
macro_rules! hello { // ← macro definition (shown in #56a8f5, bold)
() => {
println!("Hello, world!"); // ← macro call (shown in #56a8f5, bold)
};
}
Implementation Architecture
Islands Dark relies on scope-to-color mapping rather than custom language parsers. VS Code's TextMate grammar (or the Language Server Protocol) supplies token scopes, and the theme declares which scopes receive which colors in the tokenColors array.
When a language exposes specific scopes—like meta.function.decorator.python or entity.name.type.lifetime.rust—the theme applies its specialized colors. If a language lacks these specific scopes, the theme falls back to generic scopes such as entity.name.function or keyword defined earlier in the file.
The semanticTokenColors section reinforces this palette by defining colors for function, macro, type, and other semantic token types. When a language server provides semantic highlighting for Python or Rust, these definitions ensure consistent coloring across both TextMate and semantic token pipelines.
Summary
- Specific scope targeting: Islands Dark maps
meta.function.decorator.pythonto#bbb529(yellow-orange) andsupport.function.magic.pythonto#56a8f5(bright blue) inthemes/islands-dark.json. - Rust-specific treatments: Lifetimes receive
#2aacb8(cyan-green) viaentity.name.type.lifetime.rust, while macros get bold#56a8f5throughentity.name.function.macro.rust. - Visual consistency: Attributes in Rust (
meta.attribute.rust) share the same yellow-orange hue as Python decorators, creating a consistent visual language for metadata annotations. - No custom parsers required: The theme leverages standard VS Code TextMate grammars and Language Server semantic tokens, providing specialized highlighting through configuration alone.
Frequently Asked Questions
How does Islands Dark color Python decorators?
Islands Dark targets the TextMate scopes meta.function.decorator.python and entity.name.function.decorator.python in themes/islands-dark.json (around lines 921-948), applying the hex color #bbb529—a muted yellow-orange—to function decorators like @dataclass and @property.
What color does Islands Dark use for Rust lifetime parameters?
Rust lifetime identifiers (such as 'a and 'static) are colored #2aacb8—a cyan-green shade—through scope selectors including entity.name.type.lifetime.rust, storage.modifier.lifetime.rust, and punctuation.definition.lifetime.rust defined near lines 966-997 of the theme file.
Does Islands Dark require a specific language server for Python or Rust?
No. Islands Dark works with VS Code's standard TextMate grammars and any Language Server Protocol implementation. It does not ship custom parsers or require specific language servers; it simply maps the scopes provided by the editor to specific color values in the tokenColors configuration.
Where are the token color definitions stored in the repository?
All syntax highlighting rules for Python, Rust, and other languages reside in themes/islands-dark.json. Python-specific token mappings appear approximately at lines 921-948, while Rust-specific mappings follow around lines 966-997 within the tokenColors array.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →