| Crates.io | vscode-theme-syntect |
| lib.rs | vscode-theme-syntect |
| version | 0.1.1 |
| created_at | 2025-10-27 17:10:57.983276+00 |
| updated_at | 2025-10-27 17:23:02.885295+00 |
| description | Parse VSCode themes to Syntect Themes |
| homepage | |
| repository | https://github.com/Lepidopteran/quellcode/tree/main/crates/vscode-theme-syntect |
| max_upload_size | |
| id | 1903300 |
| size | 258,803 |
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.
Add this to your Cargo.toml:
[dependencies]
syntect-vscode = "0.1.1"
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());
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.