use iced::{ Border, Color, Theme, widget::{button, container}, }; use oa_core::Kind; pub const BG: Color = Color::from_rgb(0.945, 0.956, 0.969); pub const INK: Color = Color::from_rgb(0.13, 0.18, 0.25); pub const MUTED: Color = Color::from_rgb(0.43, 0.48, 0.55); pub const TEAL: Color = Color::from_rgb(0.0, 0.48, 0.43); pub const LINE: Color = Color::from_rgb(0.86, 0.89, 0.91); pub fn theme() -> Theme { Theme::custom( "Arcadia Light", iced::theme::Palette { background: BG, text: INK, primary: TEAL, success: TEAL, warning: Color::from_rgb(0.72, 0.47, 0.10), danger: Color::from_rgb(0.78, 0.22, 0.24), }, ) } pub fn card(_: &Theme) -> container::Style { container::Style { background: Some(Color::WHITE.into()), border: Border { color: LINE, width: 1., radius: 10.into(), }, ..Default::default() } } pub fn panel(_: &Theme) -> container::Style { container::Style { background: Some(Color::WHITE.into()), border: Border { color: LINE, width: 1., radius: 0.into(), }, ..Default::default() } } pub fn subtle(_: &Theme) -> container::Style { container::Style { background: Some(BG.into()), border: Border { radius: 8.into(), ..Default::default() }, ..Default::default() } } pub fn nav(theme: &Theme, status: button::Status) -> button::Style { let mut s = button::text(theme, status); if status != button::Status::Disabled { s.text_color = INK; } s.border.radius = 7.into(); if matches!(status, button::Status::Hovered | button::Status::Pressed) { s.background = Some(BG.into()); } s } pub fn selected(theme: &Theme, status: button::Status) -> button::Style { let mut s = nav(theme, status); s.background = Some(Color::from_rgb8(218, 238, 235).into()); s.text_color = INK; s.border = Border { color: Color::from_rgb8(151, 203, 195), width: 1., radius: 7.into(), }; s } pub fn kind_color(kind: Kind) -> Color { match kind { Kind::Entity | Kind::System => Color::from_rgb(0.16, 0.40, 0.71), Kind::Actor | Kind::SystemActor | Kind::Role => Color::from_rgb(0.58, 0.35, 0.70), Kind::Activity | Kind::Function => TEAL, Kind::Capability | Kind::SystemCapability | Kind::Mission | Kind::OperationalMission => { Color::from_rgb(0.72, 0.47, 0.10) } Kind::Process | Kind::FunctionalChain | Kind::Scenario | Kind::Occurrence | Kind::Lifeline => Color::from_rgb(0.65, 0.33, 0.40), Kind::StateMachine | Kind::Region | Kind::State | Kind::Mode | Kind::Initial | Kind::Final => Color::from_rgb(0.38, 0.39, 0.68), _ => Color::from_rgb(0.25, 0.48, 0.56), } }