diff --git a/src/lib.rs b/src/lib.rs index db19978..1bd8d01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,6 @@ mod room; pub use colour::Colour; pub use palette::Palette; -pub use palette::IntermediatePalette; use crate::config::Config; #[derive(Eq, Hash, PartialEq)] diff --git a/src/mock.rs b/src/mock.rs index 1cd4d47..39bb9fe 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -67,18 +67,7 @@ // } pub(crate) mod palette { - use crate::{Palette, Colour, IntermediatePalette}; - - pub(crate) fn intermediate() -> IntermediatePalette { - IntermediatePalette { - colours: vec![ - vec![0,0,0,0], - vec![0,81,104,255], - vec![118,159,155,255], - vec![155,155,155,255], - ] - } - } + use crate::{Palette, Colour}; pub(crate) fn default() -> Palette { Palette { diff --git a/src/palette.rs b/src/palette.rs index 57faf99..262e60e 100644 --- a/src/palette.rs +++ b/src/palette.rs @@ -2,7 +2,7 @@ use std::fs::read_to_string; use std::path::PathBuf; use serde_derive::{Serialize, Deserialize}; use crate::colour::Colour; -use image::{GenericImageView, Rgba, DynamicImage, Rgb, GenericImage}; +use image::{GenericImageView, Rgba, DynamicImage, GenericImage}; use image::io::Reader as ImageReader; /// todo enumerate original format @@ -13,23 +13,6 @@ pub struct Palette { } impl Palette { - pub fn from(name: &str, toml: &str) -> Self { - let intermediate: IntermediatePalette = toml::from_str(toml).unwrap(); - - println!("palette name: {}", name); - - for colour in &intermediate.colours { - println!("palette colour: {}{}{}", colour[0], colour[1], colour[2]); - } - - Palette { - name: name.to_string(), - colours: intermediate.colours.iter().map(|vec| { - Colour::from(vec.clone()) - }).collect(), - } - } - /// todo result pub fn from_file(path: PathBuf) -> Self { match path.extension().unwrap().to_str().unwrap() { @@ -38,10 +21,6 @@ impl Palette { "pal" => Self::from_jasc(path), "png" => Self::from_png(path), "txt" => Self::from_txt(path), - "toml" => Self::from( - path.file_stem().as_ref().unwrap().to_str().unwrap(), - &read_to_string(&path).unwrap() - ), _ => panic!("Bad palette") } } @@ -191,27 +170,6 @@ impl Palette { } } -/// for toml purposes -#[derive(Serialize, Deserialize)] -pub struct IntermediatePalette { - pub colours: Vec>, -} - -/// for toml purposes -#[derive(Serialize, Deserialize)] -struct IntermediatePalettes { - /// singular so each palette section is named "palette" instead of "palettes" in toml - palette: Vec, -} - -// impl IntermediatePalettes { -// pub fn from_dir() -> Self { -// Self { -// palette: vec![] -// } -// } -// } - #[cfg(test)] mod test { use std::path::PathBuf;