painter.rs
513 B · rust · 16 lines
1use super::models::CellNd;2use mrlycore::cell::mapping;3use mrlycore::colors::Color;4use mrlycore::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}