use bevy::prelude::*;
use crate::theme;
#[derive(Clone, Copy, Debug)]
pub enum GlassDepth {
Subtle,
Background,
Midground,
Foreground,
}
impl GlassDepth {
fn alpha(self) -> f32 {
match self {
GlassDepth::Subtle => theme::SUBTLE,
GlassDepth::Background => theme::BACKGROUND,
GlassDepth::Midground => theme::MIDGROUND,
GlassDepth::Foreground => theme::FOREGROUND,
}
}
}
pub fn glass(depth: GlassDepth) -> (BackgroundColor, BorderColor) {
let Color::Srgba(acid) = theme::ACID_GREEN else { unreachable!() };
(
BackgroundColor(theme::DARK_BASE),
BorderColor::all(Color::srgba(acid.red, acid.green, acid.blue, depth.alpha())),
)
}
#[derive(Component)]
pub struct Glass;
#[derive(Component)]
pub struct Saber;
pub fn saber_h(commands: &mut ChildSpawnerCommands) {
commands.spawn((
Saber,
Node {
width: Val::Percent(100.0),
height: Val::Px(1.0),
..default()
},
BackgroundColor(Color::srgba(0.13, 0.92, 0.51, 0.14)),
));
}