Initial project import
CI / Format, lint, test, build (push) Waiting to run

This commit is contained in:
Rbanh committed 2026-06-05 21:44:45 -04:00
commit f29712d158
259 files changed
+52069

No files matched your search

+138
View File
@@ -0,0 +1,138 @@
//! Unity-inspired dark pro theme for editor egui + egui_dock chrome.
use bevy_egui::egui::{self, Color32, CornerRadius, FontId, Stroke, Visuals};
use egui_dock::{Style as DockStyle, TabInteractionStyle, TabStyle};
pub const PANEL_BG: Color32 = Color32::from_rgb(32, 33, 36);
pub const PANEL_BG_DARK: Color32 = Color32::from_rgb(24, 25, 28);
pub const WIDGET_BG: Color32 = Color32::from_rgb(42, 43, 47);
pub const ELEVATED_BG: Color32 = Color32::from_rgb(55, 57, 63);
pub const ACCENT: Color32 = Color32::from_rgb(56, 121, 184);
pub const ACCENT_HOVER: Color32 = Color32::from_rgb(72, 143, 211);
pub const SELECTION_BG: Color32 = Color32::from_rgb(46, 103, 158);
pub const SELECTION_BG_MUTED: Color32 = Color32::from_rgb(43, 75, 108);
pub const TEXT: Color32 = Color32::from_rgb(226, 229, 234);
pub const TEXT_SELECTED: Color32 = Color32::from_rgb(250, 253, 255);
pub const TEXT_DIM: Color32 = Color32::from_rgb(170, 176, 184);
pub const TEXT_MUTED: Color32 = Color32::from_rgb(126, 133, 143);
pub const BORDER: Color32 = Color32::from_rgb(69, 72, 78);
pub const VIEWPORT_OVERLAY: Color32 = Color32::from_rgba_premultiplied(26, 27, 30, 220);
pub fn apply_editor_theme(ctx: &egui::Context) {
let mut visuals = Visuals::dark();
visuals.panel_fill = PANEL_BG;
visuals.window_fill = WIDGET_BG;
visuals.extreme_bg_color = PANEL_BG_DARK;
visuals.faint_bg_color = Color32::from_rgb(38, 40, 44);
visuals.code_bg_color = PANEL_BG_DARK;
visuals.text_edit_bg_color = Some(PANEL_BG_DARK);
visuals.weak_text_color = Some(TEXT_MUTED);
visuals.widgets.noninteractive.bg_fill = WIDGET_BG;
visuals.widgets.noninteractive.fg_stroke = Stroke::new(1.0, TEXT);
visuals.widgets.inactive.bg_fill = WIDGET_BG;
visuals.widgets.inactive.weak_bg_fill = Color32::from_rgb(47, 49, 54);
visuals.widgets.inactive.bg_stroke = Stroke::new(1.0, BORDER);
visuals.widgets.inactive.fg_stroke = Stroke::new(1.0, TEXT);
visuals.widgets.hovered.bg_fill = ELEVATED_BG;
visuals.widgets.hovered.weak_bg_fill = ELEVATED_BG;
visuals.widgets.hovered.bg_stroke = Stroke::new(1.0, ACCENT_HOVER);
visuals.widgets.hovered.fg_stroke = Stroke::new(1.0, TEXT_SELECTED);
visuals.widgets.active.bg_fill = SELECTION_BG;
visuals.widgets.active.weak_bg_fill = SELECTION_BG;
visuals.widgets.active.bg_stroke = Stroke::new(1.0, ACCENT_HOVER);
visuals.widgets.active.fg_stroke = Stroke::new(1.0, TEXT_SELECTED);
visuals.widgets.open.bg_fill = ELEVATED_BG;
visuals.widgets.open.weak_bg_fill = ELEVATED_BG;
visuals.widgets.open.fg_stroke = Stroke::new(1.0, TEXT_SELECTED);
visuals.selection.bg_fill = SELECTION_BG;
visuals.selection.stroke = Stroke::new(1.0, TEXT_SELECTED);
visuals.hyperlink_color = Color32::from_rgb(132, 186, 247);
visuals.warn_fg_color = Color32::from_rgb(255, 200, 80);
visuals.error_fg_color = Color32::from_rgb(255, 100, 100);
visuals.window_stroke = Stroke::new(1.0, BORDER);
visuals.window_corner_radius = CornerRadius::same(4);
let mut style = (*ctx.style()).clone();
style.visuals = visuals;
style.spacing.item_spacing = egui::vec2(8.0, 6.0);
style.spacing.button_padding = egui::vec2(8.0, 4.0);
style.spacing.indent = 16.0;
style.text_styles.insert(
egui::TextStyle::Body,
FontId::new(13.0, egui::FontFamily::Proportional),
);
style.text_styles.insert(
egui::TextStyle::Button,
FontId::new(13.0, egui::FontFamily::Proportional),
);
style.text_styles.insert(
egui::TextStyle::Heading,
FontId::new(15.0, egui::FontFamily::Proportional),
);
ctx.set_style(style);
}
pub fn editor_dock_style(ctx: &egui::Context) -> DockStyle {
let mut style = DockStyle::from_egui(ctx.style().as_ref());
style.dock_area_padding = Some(egui::Margin::same(2));
style.main_surface_border_stroke = Stroke::new(1.0, BORDER);
style.separator.width = 2.0;
style.separator.color_idle = BORDER;
style.separator.color_hovered = ELEVATED_BG;
style.separator.color_dragged = ACCENT_HOVER;
style.tab_bar.bg_fill = PANEL_BG_DARK;
style.tab_bar.height = 26.0;
style.tab_bar.hline_color = BORDER;
style.tab_bar.corner_radius = CornerRadius::ZERO;
let active = TabInteractionStyle {
outline_color: BORDER,
bg_fill: PANEL_BG,
text_color: TEXT,
corner_radius: CornerRadius::same(3),
};
let inactive = TabInteractionStyle {
outline_color: Color32::TRANSPARENT,
bg_fill: WIDGET_BG,
text_color: TEXT_DIM,
corner_radius: CornerRadius::same(3),
};
let hovered = TabInteractionStyle {
outline_color: BORDER,
bg_fill: ELEVATED_BG,
text_color: TEXT,
corner_radius: CornerRadius::same(3),
};
style.tab = TabStyle {
active: active.clone(),
inactive: inactive.clone(),
focused: active.clone(),
hovered,
inactive_with_kb_focus: inactive.clone(),
active_with_kb_focus: active.clone(),
focused_with_kb_focus: active,
..style.tab
};
style
}
pub fn panel_heading(text: &str) -> egui::RichText {
egui::RichText::new(text).strong().color(TEXT)
}
pub fn status_bar_frame() -> egui::Frame {
egui::Frame::new()
.fill(Color32::from_rgb(0, 122, 204))
.inner_margin(egui::Margin::symmetric(8, 2))
}
pub fn viewport_toolbar_frame() -> egui::Frame {
egui::Frame::new()
.fill(VIEWPORT_OVERLAY)
.corner_radius(CornerRadius::same(4))
.inner_margin(egui::Margin::same(4))
.stroke(Stroke::new(1.0, BORDER))
}