vscode-theme-syntect 0.1.0

Parse VSCode themes to Syntect Themes
Documentation

VSCode Theme Syntect

Crates.io Version

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.0"

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