use bevy::{prelude::*, ui::FocusPolicy};
use bevy_ecss::prelude::{
Class, EcssPlugin, RegisterComponentSelector, StyleSheet, StyleSheetAsset,
};
#[derive(Component, Debug, Default, Reflect)]
#[reflect(Component)]
struct Title;
fn main() {
let mut app = App::new();
app.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
canvas: Some("#bevy".to_string()),
..default()
}),
..default()
}))
.add_plugins(EcssPlugin::with_hot_reload())
.add_systems(Startup, setup)
.add_systems(Update, change_theme)
.register_component_selector::
("title");
app.run();
}
#[derive(Resource)]
struct Themes {
pub root: Entity,
pub dark: Handle,
pub light: Handle,
}
fn change_theme(
themes: Res,
mut styles_query: Query<&mut StyleSheet>,
interaction_query: Query<&Interaction, (Changed, With