a better coloring crate
-rw-r--r--src/cfstr.rs8
-rw-r--r--tests/basic.rs5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/cfstr.rs b/src/cfstr.rs
index ef332db..c42fe9f 100644
--- a/src/cfstr.rs
+++ b/src/cfstr.rs
@@ -88,9 +88,11 @@ impl Parse for CFStr {
temp.clear();
break;
} else if let Some((b, a)) = temp.split_once(':') {
- if let Some(a) = name2ansi(a) {
- out.push_str(name2ansi("reset").unwrap());
- out.push_str(a);
+ if let Some(ansi) = name2ansi(a) {
+ if a != "reset" {
+ out.push_str(name2ansi("reset").unwrap());
+ }
+ out.push_str(ansi);
out.push('{');
out.push_str(b);
out.push('}');
diff --git a/tests/basic.rs b/tests/basic.rs
index 37b809e..21a4ace 100644
--- a/tests/basic.rs
+++ b/tests/basic.rs
@@ -15,3 +15,8 @@ fn escapes() {
fn take() {
assert_eq!(comat!("{}"), "{}");
}
+
+#[test]
+fn resetty() {
+ assert_eq!(comat!("{:reset}"), "\x1b[0m{}\x1b[0m")
+}