| Crates.io | terminal-profiles |
| lib.rs | terminal-profiles |
| version | 0.1.0 |
| created_at | 2025-07-10 00:50:00.269777+00 |
| updated_at | 2025-07-10 00:50:00.269777+00 |
| description | terminal-profiles |
| homepage | https://github.com/ahaoboy/terminal-profiles |
| repository | https://github.com/ahaoboy/terminal-profiles |
| max_upload_size | |
| id | 1745673 |
| size | 134,725 |
This is a Rust library for parsing and managing Windows Terminal configuration files. It provides comprehensive serde structs to serialize and deserialize the Windows Terminal profiles.json configuration file.
Windows Terminal Profiles Schema
Add the dependency to your Cargo.toml:
[dependencies]
terminal-profiles = "0.1.0"
use terminal_profiles::WindowsTerminalSettings;
let s = std::fs::read_to_string("settings.json").unwrap();
let profiles: WindowsTerminalSettings = serde_json::from_str(&s).unwrap();
The primary configuration struct, containing all Windows Terminal settings:
default_profile: GUID of the default profileprofiles: List of profilesschemes: List of color schemesactions: Custom actionskeybindings: Keybinding mappingsthemes: Theme configurationsStruct for a single profile:
guid: Unique identifiername: Profile namecommandline: Startup commandstarting_directory: Starting directorycolor_scheme: Color schemefont: Font configurationbackground: Background settingscursor_shape: Cursor shapeColor scheme struct:
name: Scheme namebackground: Background colorforeground: Foreground colorblack, red, green, blue, yellow, purple, cyan, white: Base colorsbright_*: Bright colorsfrom_json(json: &str): Create configuration from JSON stringto_json() -> Result<String, serde_json::Error>: Convert to JSON stringget_default_profile() -> Option<&Profile>: Get the default profileget_all_profiles() -> &[Profile]: Get all profilesfind_profile_by_guid(guid: &str) -> Option<&Profile>: Find profile by GUIDfind_profile_by_name(name: &str) -> Option<&Profile>: Find profile by namefind_scheme_by_name(name: &str) -> Option<&ColorScheme>: Find color scheme by nameis_hidden() -> bool: Check if the profile is hiddenget_font_face() -> Option<&str>: Get font faceget_font_size() -> Option<f64>: Get font sizeget_font_weight() -> Option<&FontWeight>: Get font weightget_all_colors() -> HashMap<&str, &str>: Get all colorsThe library provides rich enum types for type safety:
LaunchMode: Launch mode (fullscreen, maximized, default, etc.)CursorShape: Cursor shape (bar, block, underline, etc.)FontWeight: Font weightBackgroundImageAlignment: Background image alignmentCloseOnExit: Close behaviorTabWidthMode: Tab width modeShortcutActionName: Shortcut action nameRun the example program:
cargo run
Run tests:
cargo test
MIT License
Issues and Pull Requests are welcome!