bevy_basic_ui/
styles.rs

1use bevy::prelude::*;
2
3pub const NORMAL_BUTTON_COLOR: Color = Color::rgb(0.15, 0.15, 0.15);
4pub const HOVERED_BUTTON_COLOR: Color = Color::rgb(0.25, 0.25, 0.25);
5pub const PRESSED_BUTTON_COLOR: Color = Color::rgb(0.35, 0.35, 0.35);
6
7pub const CENTRAL_PANEL_STYLES: Style = {
8    let mut style = Style::DEFAULT;
9    style.flex_direction = FlexDirection::Column;
10    style.justify_content = JustifyContent::Center;
11    style.align_items = AlignItems::Center;
12    style.width = Val::Percent(100.0);
13    style.height = Val::Percent(100.0);
14    style.row_gap = Val::Px(8.0);
15    style.column_gap = Val::Px(8.0);
16    style
17};
18
19pub const BASIC_BUTTON_STYLE: Style = {
20    let mut style = Style::DEFAULT;
21    style.align_items = AlignItems::Center;
22    style.justify_content = JustifyContent::Center;
23    style.width = Val::Px(200.0);
24    style.height = Val::Px(80.0);
25    style
26};
27
28pub const IMAGE_STYLE: Style = {
29    let mut style = Style::DEFAULT;
30    style.width = Val::Px(32.0);
31    style.height = Val::Px(32.0);
32    style.margin = UiRect::new(Val::Px(8.0), Val::Px(8.0), Val::Px(8.0), Val::Px(8.0));
33    style
34};
35
36pub const TITLE_STYLE: Style = {
37    let mut style = Style::DEFAULT;
38    style.flex_direction = FlexDirection::Row;
39    style.justify_content = JustifyContent::Center;
40    style.align_items = AlignItems::Center;
41    style.width = Val::Px(600.0);
42    style.height = Val::Px(120.0);
43    style
44};
45
46pub fn get_title_text_styles(asset_server: &Res<AssetServer>) -> TextStyle {
47    TextStyle {
48        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
49        font_size: 64.0,
50        color: Color::WHITE,
51    }
52}
53
54pub fn get_button_text_styles(asset_server: &Res<AssetServer>) -> TextStyle {
55    TextStyle {
56        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
57        font_size: 32.0,
58        color: Color::WHITE,
59    }
60}