Ravenwood is a refined forest theme for Visual Studio Code, inspired by the Everforest color scheme. It is characterized by deeper, more saturated emerald greens and a modular architecture that allows for dynamic theme generation based on user settings.
- Purpose: Provide a vibrant and eye-friendly emerald forest theme for VS Code.
- Main Technologies: TypeScript, Node.js, VS Code Extension API.
- Key Feature: Dynamic theme generation. Unlike static themes, Ravenwood regenerates its JSON theme files at runtime when users change specific configurations (e.g., contrast, workbench style, italics).
The project is structured to separate color palettes from UI and syntax rules:
src/palette/: Contains color definitions fordarkandlightvariants, subdivided by contrast levels (hard,medium,soft).src/workbench/: Defines workbench (UI) colors, supporting different styles likematerial,flat, andhigh-contrast.src/syntax/: Defines syntax highlighting rules, including optional italics for keywords and comments.src/semantic.ts: Defines semantic highlighting rules (LSP token colors).src/utils.ts: Core utility class for reading VS Code configuration, detecting changes, and generating theme JSON files.src/hook/generateThemes.ts: A build-time script used to generate the initial/default theme files in thethemes/directory.themes/: Contains the generatedravenwood-dark.jsonandravenwood-light.jsonfiles. These files are updated by the extension at runtime.
npm run compile: Cleans thedistfolder, compiles TypeScript, and generates the default themes. This is the primary build command.npm run compile:ts: Compiles TypeScript source files.npm run compile:themes: Executes the theme generation hook (dist/hook/generateThemes.js).npm run lint: Runs Biome check (lint + format check).npm run format: Auto-formats with Biome format --write.npm run clean: Removes thedistdirectory and packaged.vsixfiles.npm run package: Packages the extension into a.vsixfile usingvsce.
- Adding Configurations: To add a new user-customizable option:
- Update
contributes.configurationinpackage.json. - Add the property to the
Configurationinterface insrc/interface.tswith a proper union type. - If enum-valued, add to the
ALLOWEDarray insrc/validation.tssovalidateConfig()catches typos. - The type system (union types +
neverexhaustiveness checks) handles the rest.
- Update
- Modifying Colors: Colors are managed in
src/palette/. Changes there will propagate throughsrc/workbench/andsrc/syntax/. - Code Style:
- Strict typing is enforced via TypeScript.
- Linting and formatting are handled by Biome (via
lint-staged).
- Follow existing modular patterns when adding new syntax or workbench rules.
- Ensure that changes to the theme logic are reflected in both the build-time hook and the runtime utility class.
- Always run
npm run compileandnpm run lintbefore submitting changes.