#[derive(Debug)]
pub struct Color {
hex: String,
}
impl Color {
pub fn from_vec_of_hex_strings(color_strings: Vec<&str>) -> Vec<Self> {
let mut colors = Vec::new();
for color in color_strings.iter() {
colors.push(Color { hex: String::from(*color) })
}
colors
}
pub fn color_scheme_10() -> Vec<Self> {
vec!(
Color { hex: "#1f77b4".to_string() },
Color { hex: "#ff7f0e".to_string() },
Color { hex: "#2ca02c".to_string() },
Color { hex: "#d62728".to_string() },
Color { hex: "#9467bd".to_string() },
Color { hex: "#8c564b".to_string() },
Color { hex: "#e377c2".to_string() },
Color { hex: "#7f7f7f".to_string() },
Color { hex: "#bcbd22".to_string() },
Color { hex: "#17becf".to_string() },
)
}
pub fn color_scheme_tableau_10() -> Vec<Self> {
vec!(
Color { hex: "#4e79a7".to_string() },
Color { hex: "#f28e2c".to_string() },
Color { hex: "#e15759".to_string() },
Color { hex: "#76b7b2".to_string() },
Color { hex: "#59a14f".to_string() },
Color { hex: "#edc949".to_string() },
Color { hex: "#af7aa1".to_string() },
Color { hex: "#ff9da7".to_string() },
Color { hex: "#9c755f".to_string() },
Color { hex: "#bab0ab".to_string() },
)
}
pub fn color_scheme_dark() -> Vec<Self> {
vec!(
Color { hex: "#1b9e77".to_string() },
Color { hex: "#d95f02".to_string() },
Color { hex: "#7570b3".to_string() },
Color { hex: "#e7298a".to_string() },
Color { hex: "#66a61e".to_string() },
Color { hex: "#e6ab02".to_string() },
Color { hex: "#a6761d".to_string() },
Color { hex: "#666666".to_string() },
)
}
pub fn as_hex(&self) -> String {
String::from(&self.hex)
}
}