Skip to content

Commit b49e903

Browse files
committed
✨ Add new xterm-color crate
1 parent 0d1b897 commit b49e903

File tree

8 files changed

+437
-15
lines changed

8 files changed

+437
-15
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,19 @@ version = "0.4.7"
77

88
[workspace.dependencies]
99
terminal-colorsaurus = { path = "crates/terminal-colorsaurus", version = "0.4.4" }
10+
11+
[workspace.lints.rust]
12+
missing_debug_implementations = "warn"
13+
missing_docs = "warn"
14+
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(terminal_colorsaurus_test_unsupported)"] }
15+
16+
[workspace.lints.clippy]
17+
dbg_macro = "warn"
18+
exhaustive_enums = "warn"
19+
exhaustive_structs = "warn"
20+
undocumented_unsafe_blocks = "deny"
21+
unimplemented = "warn"
22+
uninlined_format_args = "warn"
23+
unnested_or_patterns = "warn"
24+
unwrap_used = "deny"
25+
use_debug = "warn"

crates/terminal-colorsaurus/Cargo.toml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,8 @@ libc = { version = "0.2.151", optional = true }
3333
[target.'cfg(windows)'.dependencies]
3434
windows-sys = { version = "0.59.0", features = ["Win32_System_Threading"], optional = true } # Keep this in sync with terminal-trx's version to avoid duplicate deps.
3535

36-
[lints.rust]
37-
missing_debug_implementations = "warn"
38-
missing_docs = "warn"
39-
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(terminal_colorsaurus_test_unsupported)"] }
40-
41-
[lints.clippy]
42-
dbg_macro = "warn"
43-
exhaustive_enums = "warn"
44-
exhaustive_structs = "warn"
45-
undocumented_unsafe_blocks = "deny"
46-
unimplemented = "warn"
47-
uninlined_format_args = "warn"
48-
unnested_or_patterns = "warn"
49-
unwrap_used = "deny"
50-
use_debug = "warn"
36+
[lints]
37+
workspace = true
5138

5239
[package.metadata.docs.rs]
5340
all-features = true

crates/xterm-color/Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "xterm-color"
3+
description = "Parses the subset of X11 Color Strings emitted by terminals in response to OSC color queries"
4+
readme = "readme.md"
5+
repository = "https://github.com/bash/terminal-colorsaurus"
6+
categories = ["command-line-interface"]
7+
keywords = ["x11", "xterm", "color"]
8+
license = "MIT OR Apache-2.0"
9+
version = "1.0.0"
10+
edition = "2021"
11+
rust-version = "1.70.0"
12+
13+
[lints]
14+
workspace = true

crates/xterm-color/license-apache.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../license-apache.txt

crates/xterm-color/license-mit.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../license-mit.txt

crates/xterm-color/readme.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# xterm-color
2+
3+
[![Docs](https://img.shields.io/docsrs/xterm-color/latest)](https://docs.rs/xterm-color)
4+
[![Crate Version](https://img.shields.io/crates/v/xterm-color)](https://crates.io/crates/xterm-color)
5+
6+
Parses the subset of X11 [Color Strings][x11] emitted by terminals in response to [`OSC` color queries][osc] (`OSC 10`, `OSC 11`, ...).
7+
8+
[osc]: https://www.invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
9+
[x11]: https://www.x.org/releases/current/doc/libX11/libX11/libX11.html#Color_Strings
10+
11+
## Example
12+
```rust
13+
use xterm_color::Color;
14+
let color = Color::parse(b"rgb:11/aa/ff").unwrap();
15+
assert_eq!(color, Color::rgb(0x1111, 0xaaaa, 0xffff));
16+
```
17+
18+
## [Docs](https://docs.rs/xterm-color)
19+
20+
## License
21+
Licensed under either of
22+
23+
* Apache License, Version 2.0
24+
([license-apache.txt](license-apache.txt) or <http://www.apache.org/licenses/LICENSE-2.0>)
25+
* MIT license
26+
([license-mit.txt](license-mit.txt) or <http://opensource.org/licenses/MIT>)
27+
28+
at your option.
29+
30+
## Contribution
31+
Unless you explicitly state otherwise, any contribution intentionally submitted
32+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
33+
dual licensed as above, without any additional terms or conditions.

0 commit comments

Comments
 (0)