made it easier to make color themes

This commit is contained in:
Ellie D 2019-06-17 19:05:23 -05:00
parent 77e0853b5f
commit 3144910b69
1 changed files with 9 additions and 7 deletions

View File

@ -37,6 +37,8 @@ fn main() {
let mut cyclecount:usize = 0;
let mut scalemax:f32 = startmax;
let colors:Vec<u8> = vec![16,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];
loop {
match source.read_exact(&mut ibuffer) {
Err(why) => match why.kind() {
@ -75,15 +77,15 @@ fn main() {
if power2 > linemax {
linemax = power2;
}
let mut color1 = 232 + ((power1/scalemax)*23.0).round() as u32;
let mut color2 = 232 + ((power2/scalemax)*23.0).round() as u32;
if color1 > 255 {
color1 = 255;
let mut colorindex1 = ((power1/scalemax)*colors.len() as f32).round() as usize;
let mut colorindex2 = ((power2/scalemax)*colors.len() as f32).round() as usize;
if colorindex1 >= colors.len() {
colorindex1 = colors.len()-1;
}
if color2 > 255 {
color2 = 255;
if colorindex2 >= colors.len() {
colorindex2 = colors.len()-1;
}
print!("\x1b[38;5;{}m\x1b[48;5;{}m▌", color1, color2);
print!("\x1b[38;5;{}m\x1b[48;5;{}m▌", colors[colorindex1], colors[colorindex2]);
//print!("{:10}", power.round());
}
println!("\x1b[0m");