use blinc_core::Color;
pub const BG: Color = Color::rgba(0.04, 0.04, 0.05, 1.0); pub const ACCENT: Color = Color::rgba(0.77, 0.58, 0.42, 1.0); pub const EDGE_COLOR: Color = Color::rgba(0.29, 0.29, 0.33, 1.0); pub const TEXT_COLOR: Color = Color::rgba(0.91, 0.90, 0.89, 1.0); pub const TEXT_DIM: Color = Color::rgba(0.53, 0.53, 0.53, 0.8); pub const BORDER: Color = Color::rgba(0.16, 0.16, 0.21, 1.0);
pub const NODE_RADIUS: f32 = 16.0;
pub const NODE_PALETTE: [Color; 8] = [
Color::rgba(0.77, 0.58, 0.42, 1.0), Color::rgba(0.40, 0.70, 0.90, 1.0), Color::rgba(0.60, 0.85, 0.55, 1.0), Color::rgba(0.85, 0.50, 0.55, 1.0), Color::rgba(0.70, 0.55, 0.85, 1.0), Color::rgba(0.90, 0.75, 0.40, 1.0), Color::rgba(0.45, 0.80, 0.75, 1.0), Color::rgba(0.85, 0.60, 0.75, 1.0), ];
pub fn label_color(label: &str) -> Color {
let hash = label
.bytes()
.fold(0u32, |acc, b| acc.wrapping_mul(31).wrapping_add(b as u32));
NODE_PALETTE[(hash as usize) % NODE_PALETTE.len()]
}
pub fn label_color_idx(label: &str) -> u8 {
let hash = label
.bytes()
.fold(0u32, |acc, b| acc.wrapping_mul(31).wrapping_add(b as u32));
(hash as usize % NODE_PALETTE.len()) as u8
}