painter.rs
522 B · rust · 16 lines
1use super::models::CellNd;2use crate::core::cell::mapping;3use crate::core::colors::Color;4use crate::core::enums::Mode;5use std::collections::HashMap;67/// Colors the cell through the given mapping and mode, defaulting to the standard palette by type.8pub fn paint<const N: usize>(9 cell: CellNd<N>,10 custom: Option<&HashMap<u8, Vec<Color>>>,11 mode: Option<Mode>,12) -> CellNd<N> {13 let defaults = mapping();14 let mapping = custom.unwrap_or(&defaults);15 cell.paint(mapping, mode.unwrap_or(Mode::Type))16}