Commit 333e52df authored by toby's avatar toby

palette -> colors

parent 417de082
......@@ -6,9 +6,9 @@ use termion::{color, style, cursor, clear};
#[derive(Debug)]
struct Color(u8, u8, u8);
type Palette = Vec<Color>;
type Colors = Vec<Color>;
fn full_palette(max_color: u8) -> Palette {
fn full_palette(max_color: u8) -> Colors {
let ex_max = max_color + 1;
let mut pal = Vec::new();
for r in 0..ex_max {
......@@ -32,9 +32,9 @@ fn console_reset() {
print!("{}", cursor::Goto(1,1));
}
fn render_palette(pal: &Palette, columns: u8) {
for i in 0..pal.len() {
print_color(&pal[i]);
fn render_colors(colors: &Colors, columns: u8) {
for i in 0..colors.len() {
print_color(&colors[i]);
if (i as u8 + 1) % columns == 0 {
println!("");
}
......@@ -44,7 +44,7 @@ fn render_palette(pal: &Palette, columns: u8) {
fn main() {
console_reset();
let max_pal = 5; // Terminal colors
let pal = full_palette(max_pal);
render_palette(&pal, max_pal + 1);
let max_colors = 5; // Terminal colors
let colors = full_palette(max_colors);
render_colors(&colors, max_colors + 1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment