forked from ratatui/ansi-to-tui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed the style module and main module. Added README
- Loading branch information
1 parent
8581b1a
commit 6e2e4dd
Showing
10 changed files
with
23 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
[package] | ||
name = "ansi-to-tui" | ||
version = "0.1.0" | ||
version = "0.1.1" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
tui = { version = "0.14.0", default-features = false, features = ["crossterm"] } | ||
unicode-width = "0.1.8" | ||
tui = { version = "0.14.0", default-features = false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ansi-to-tui | ||
|
||
Parse text with ansi color codes and turn them into [`tui::text::Text`](https://docs.rs/tui/0.14.0/tui/text/struct.Text.html). | ||
|
||
Supports TrueColor ( RGB ) ( `\x1b[38;2;<r>;<g>;<b>m`) | ||
Supports 8 - Bit Color ( 0..256 ) ( `\x1b[38;5;<n>m` ) | ||
Supports 4 - Bit Color Pallete ( `\x1b[30..37;40..47m` ) | ||
|
||
A naive implementation, relatively fast. | ||
Only dependency is the tui crate. | ||
Lots of room for improvement. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ pub enum Error { | |
StackLocked, | ||
StackUnlocked, | ||
InvalidAnsi, | ||
TempError, | ||
UnknownColor, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ mod code; | |
mod color; | ||
mod error; | ||
mod stack; | ||
mod style; | ||
mod tests; | ||
|
||
pub use ansi::ansi_to_text; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
#[cfg(test)] | ||
#[test] | ||
fn test_color() { | ||
use crate::ansi_to_color; | ||
use crate::stack::Stack; | ||
use tui::style::Color; | ||
assert_eq!(ansi_to_color(31_u8), Color::Red); | ||
let mut stack: Stack<u8> = Stack::new(); | ||
stack.push(30); | ||
assert_eq!(stack.parse_color().unwrap(), Color::Indexed(30)); | ||
stack.push(30); | ||
stack.push(3); | ||
stack.push(55); | ||
assert_eq!(stack.parse_color().unwrap(), Color::Rgb(30, 3, 55)); | ||
} |