More like lolcat.
This commit is contained in:
15
src/main.rs
15
src/main.rs
@@ -9,15 +9,22 @@ use rand::{thread_rng, Rng};
|
|||||||
use ansi_term::Colour::RGB;
|
use ansi_term::Colour::RGB;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut s = thread_rng().gen_range(0.0, 256.0);
|
let mut s = 1.0; // thread_rng().gen_range(0.0, 256.0);
|
||||||
|
|
||||||
let stdin = io::stdin();
|
let stdin = io::stdin();
|
||||||
|
|
||||||
for line in stdin.lock().lines() {
|
for line in stdin.lock().lines() {
|
||||||
s += 0.8;
|
s += 1.0;
|
||||||
|
|
||||||
for (n, c) in line.unwrap().chars().enumerate() {
|
let mut d = 0;
|
||||||
let (red, green, blue) = rainbow(0.1, s + n as f32);
|
|
||||||
|
for c in line.unwrap().chars() {
|
||||||
|
d += match c {
|
||||||
|
'\t' => 8,
|
||||||
|
_ => 1
|
||||||
|
};
|
||||||
|
|
||||||
|
let (red, green, blue) = rainbow(0.1, (s + d as f32) / 3.0);
|
||||||
|
|
||||||
print!("{}", RGB(red, green, blue).paint(c.to_string()));
|
print!("{}", RGB(red, green, blue).paint(c.to_string()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user