{"id":45703785,"url":"https://github.com/ynqa/termcfg","last_synced_at":"2026-03-02T04:00:30.796Z","repository":{"id":340352285,"uuid":"1164499125","full_name":"ynqa/termcfg","owner":"ynqa","description":"Terminal shortcut and style configurations","archived":false,"fork":false,"pushed_at":"2026-02-25T14:53:25.000Z","size":39,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-26T00:43:26.311Z","etag":null,"topics":["color","configuration","crossterm","keybind","rust","style","terminal","termion","toml"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ynqa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ynqa"}},"created_at":"2026-02-23T06:35:43.000Z","updated_at":"2026-02-25T12:32:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ynqa/termcfg","commit_stats":null,"previous_names":["ynqa/termcfg"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ynqa/termcfg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynqa%2Ftermcfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynqa%2Ftermcfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynqa%2Ftermcfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynqa%2Ftermcfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ynqa","download_url":"https://codeload.github.com/ynqa/termcfg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynqa%2Ftermcfg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29879894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"ssl_error","status_checked_at":"2026-02-26T23:50:46.793Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color","configuration","crossterm","keybind","rust","style","terminal","termion","toml"],"created_at":"2026-02-24T23:30:46.636Z","updated_at":"2026-03-01T03:00:46.289Z","avatar_url":"https://github.com/ynqa.png","language":"Rust","readme":"# termcfg\n\n*termcfg* is a library for converting terminal events and styles to and from compact strings for configuration files in Rust.\n\n## Features\n\n- Convert between terminal events and human-readable shortcut strings\n- Convert between terminal styles and compact style strings\n- `serde` helpers to easily serialize and deserialize terminal events and styles in configuration files\n- Supports keyboard and mouse events\n- Feature-gated backend modules: `crossterm` and `termion`\n\n## Installation\n\nIf you want to use `crossterm` v0.29.0:\n\n```toml\n[dependencies]\ntermcfg = { version = \"0.1.0\", features = [\"crossterm_0_29_0\"] }\n```\n\nelse if you want to use `termion` v4.0.6:\n\n```toml\n[dependencies]\ntermcfg = { version = \"0.1.0\", features = [\"termion_4_0_6\"] }\n```\n\n## Notation\n\nSee [Notations.md](./Notations.md) for the backend compatibility matrix between `crossterm` and `termion`.\n\n### Shortcut\n\nThe shortcut string consists of zero or more modifiers followed by an event token.\nModifiers are separated by `+` and can be `Ctrl`, `Alt`, `Shift` etc.\nThe event token can be a key code (e.g., `A`, `F1`, `Enter`) or a mouse token (e.g., `LeftDown`, `ScrollUp`).\n\nFor example, `Ctrl+Shift+C` represents the combination of the Control and Shift modifiers with the 'C' key.\n\n### Styling\n\nThe style string consists of zero or more style attributes separated by commas.\nEach attribute can be a foreground color (`fg`), background color (`bg`),\nunderline color (`ul`, only supported in `crossterm`), or text attribute (`attr`).\nColors can be specified as named colors (e.g., `red`, `blue`), RGB values (e.g., `#RRGGBB`).\nText attributes can be `bold`, `underlined`, `italic`, etc., and can be combined using the `|` separator.\n\nFor example, `fg=red,bg=#112233,ul=#0C0C0C,attr=bold|underlined|italic` represents a style with a red foreground,\na background color of `#112233`, an underline color of `#0C0C0C`, and text attributes of bold, underlined, and italic.\n\n## Example\n\nThis example demonstrates how to use `termcfg` to deserialize a TOML configuration\ncontaining a set of keybinds and a content style for `crossterm`.\n\n```rust\nuse std::collections::HashSet;\n\nuse crossterm::{\n    event::{Event, KeyCode, KeyEvent, KeyModifiers},\n    style::{Attribute, Color, ContentStyle},\n};\nuse serde::{Deserialize, Serialize};\nuse termcfg::crossterm_config::{content_style_serde, event_set_serde};\n\n#[derive(Deserialize, Serialize)]\nstruct ExampleConfig {\n    #[serde(with = \"event_set_serde\")]\n    keybind: HashSet\u003cEvent\u003e,\n    #[serde(with = \"content_style_serde\")]\n    style: ContentStyle,\n}\n\nfn main() {\n    let content = r##\"\nkeybind = [\"Ctrl+C\", \"Shift+Down\"]\nstyle = \"fg=red,bg=#112233,ul=#0C0C0C,attr=bold|underlined|italic\"\n\"##;\n\n    let config: ExampleConfig = toml::from_str(content).expect(\"failed to parse TOML\");\n\n    assert!(config.keybind.contains(\u0026Event::Key(KeyEvent::new(\n        KeyCode::Down,\n        KeyModifiers::SHIFT,\n    ))));\n    assert!(config.keybind.contains(\u0026Event::Key(KeyEvent::new(\n        KeyCode::Char('c'),\n        KeyModifiers::CONTROL,\n    ))));\n    assert_eq!(config.style.foreground_color, Some(Color::Red));\n    assert_eq!(\n        config.style.background_color,\n        Some(Color::Rgb {\n            r: 0x11,\n            g: 0x22,\n            b: 0x33,\n        })\n    );\n    assert_eq!(\n        config.style.underline_color,\n        Some(Color::Rgb {\n            r: 0x0C,\n            g: 0x0C,\n            b: 0x0C,\n        })\n    );\n    assert!(config.style.attributes.has(Attribute::Bold));\n    assert!(config.style.attributes.has(Attribute::Underlined));\n    assert!(config.style.attributes.has(Attribute::Italic));\n\n    let serialized = toml::to_string(\u0026config).expect(\"failed to serialize TOML\");\n    println!(\"Serialized TOML:\\n{}\", serialized);\n\n    println!(\"{}\", config.style.apply(\"hello termcfg\"));\n}\n```\n","funding_links":["https://github.com/sponsors/ynqa"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynqa%2Ftermcfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fynqa%2Ftermcfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynqa%2Ftermcfg/lists"}