| Crates.io | sublime-color-scheme |
| lib.rs | sublime-color-scheme |
| version | 0.1.4 |
| created_at | 2025-03-04 01:27:31.878615+00 |
| updated_at | 2025-06-01 20:39:58.016479+00 |
| description | Parse Sublime Text color schemes to Syntect Themes |
| homepage | |
| repository | https://github.com/Lepidopteran/quellcode/tree/main/sublime-color-scheme |
| max_upload_size | |
| id | 1576623 |
| size | 251,195 |
This is a simple library to parse a sublime color scheme to a syntect::highlighting::Theme.
I wrote this to use within my project quellcode, but other projects may find it useful.
Min Contrast is supported but I'm im not sure if I implemented correctly. Please open an issue if it doesn't work.
Add this to your Cargo.toml:
[dependencies]
sublime-color-scheme = "0.1.2"
use sublime_color_scheme::ColorScheme;
use syntect::highlighting::Theme;
use std::{path::Path, fs::read_to_string};
let path = Path::new("path/to/file.sublime-color-scheme");
let scheme = read_to_string(path).expect("Failed to read file");
let color_scheme = ColorScheme::from_str(&scheme).expect("Failed to parse theme");
// or
// let color_scheme = sublime_color_scheme::parse_color_scheme(&scheme).expect("Failed to parse theme");
// or
// let color_scheme = sublime_color_scheme::parse_color_scheme_file(path).expect("Failed to parse theme");
Theme::try_from(scheme).expect("Failed to convert to theme");
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, but it is not required.
Thanks to philpax for the original implementation.
See here for original