From 0fc2fc8b7e04135011e1044a1d83a29c2b14c05a Mon Sep 17 00:00:00 2001 From: TheBlueRuby <109350270+TheBlueRuby@users.noreply.github.com> Date: Wed, 2 Nov 2022 07:06:55 +1100 Subject: [PATCH] added proper colors and resynced --- Cargo.lock | 32 ++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 9 +++++---- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d6bf76..700e6ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,6 +24,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -34,6 +45,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" name = "badapple-ascii1" version = "0.1.0" dependencies = [ + "colored", "rodio", ] @@ -133,6 +145,17 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688" +[[package]] +name = "colored" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +dependencies = [ + "atty", + "lazy_static", + "winapi", +] + [[package]] name = "combine" version = "4.6.6" @@ -211,6 +234,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hound" version = "3.5.0" diff --git a/Cargo.toml b/Cargo.toml index b485700..6f10e1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,4 @@ edition = "2021" [dependencies] rodio = "0.16.0" +colored = "2.0.0" diff --git a/src/main.rs b/src/main.rs index 9d00c3b..fa3a6a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use std::{fs, io::BufReader, thread, time::Duration}; use rodio::{source::Source, Decoder, OutputStream}; +use colored::*; fn main() { print!("\x1B[2J\x1B[1;1H"); @@ -22,13 +23,13 @@ fn main() { .unwrap(); while frame_num <= 2180 { - print!("\x1b[1;1H"); //equiv to cls or clear - print!("{}", frames[frame_num]); + print!("{}", "\x1b[1;1H".white().on_black()); //equiv to cls or clear + print!("{}", frames[frame_num].black().on_white()); frame_num += 1; - thread::sleep(Duration::from_secs_f32(1.0 / 10.625)); + thread::sleep(Duration::from_secs_f32(1.0 / 10.67125)); // I spent literal hours figuring the exact value out compensating for lag } - print!("\x1B[2J\x1B[1;1H"); + print!("{}", "\x1B[2J\x1B[1;1H".white().on_black()); }