vscode-theme-syntect

Crates.iovscode-theme-syntect
lib.rsvscode-theme-syntect
version0.1.1
created_at2025-10-27 17:10:57.983276+00
updated_at2025-10-27 17:23:02.885295+00
descriptionParse VSCode themes to Syntect Themes
homepage
repositoryhttps://github.com/Lepidopteran/quellcode/tree/main/crates/vscode-theme-syntect
max_upload_size
id1903300
size258,803
Blaine (Lepidopteran)

documentation

README

VSCode Theme Syntect

Crates.io Version docs.rs

This is a simple library to parse a vscode theme to a syntect::highlighting::Theme.

I wrote this to use within my project quellcode, but other projects may find it useful.

Installation

Add this to your Cargo.toml:

[dependencies]
syntect-vscode = "0.1.1"

Usage

Parse from a string using parse_vscode_theme:

use syntect::highlighting::Theme;
use vscode_theme_syntect::parse_vscode_theme;

let theme = parse_vscode_theme(include_str!("../assets/palenight.json")).expect("Failed to parse theme");

assert!(Theme::try_from(theme).is_ok());

Parse from a string using VscodeTheme::from_str:

use syntect::highlighting::Theme;
use vscode_theme_syntect::VscodeTheme;
use std::str::FromStr;

let theme = VscodeTheme::from_str(include_str!("../assets/palenight.json")).expect("Failed to parse theme");

assert!(Theme::try_from(theme).is_ok());

Parse from a file using parse_vscode_theme_from_file

use std::path::Path;
use syntect::highlighting::Theme;
use vscode_theme_syntect::parse_vscode_theme_from_file;

let theme = parse_vscode_theme_from_file(Path::new("assets/palenight.json")).expect("Failed to parse theme");

assert!(Theme::try_from(theme).is_ok());

Contributing

Pull requests are welcome.

Some things that need to be done is add more unit tests.

If you do decide to contribute, it is recommended to follow the Conventional Commits specification when typing your commit messages.

License

Apache 2.0

Commit count: 204

cargo fmt