Merge branch 'rust-ui' of /home/skyler/Dev/Lightningbeam-2/. into rust-ui

This commit is contained in:
Skyler Lehmkuhl
2026-03-04 14:43:18 -05:00
24 changed files with 1674 additions and 441 deletions
@@ -683,6 +683,26 @@ struct FolderContextMenuState {
position: egui::Pos2,
}
/// Get background color for an interactive item based on its state
fn item_state_bg(
theme: &crate::theme::Theme,
ctx: &egui::Context,
pane_ctx: &str,
is_dragging: bool,
is_selected: bool,
is_hovered: bool,
) -> egui::Color32 {
if is_dragging {
theme.bg_color(&[pane_ctx, ".item", ".dragging"], ctx, egui::Color32::from_rgb(80, 100, 120))
} else if is_selected {
theme.bg_color(&[pane_ctx, ".item", ".selected"], ctx, egui::Color32::from_rgb(60, 80, 100))
} else if is_hovered {
theme.bg_color(&[pane_ctx, ".item", ".hover"], ctx, egui::Color32::from_rgb(45, 45, 45))
} else {
theme.bg_color(&[pane_ctx, ".item"], ctx, egui::Color32::from_rgb(35, 35, 35))
}
}
pub struct AssetLibraryPane {
/// Current search filter text
search_filter: String,
@@ -1335,7 +1355,7 @@ impl AssetLibraryPane {
// Background
let bg_style = shared.theme.style(".panel-header", ui.ctx());
let bg_color = bg_style
.background_color
.background_color()
.unwrap_or(egui::Color32::from_rgb(30, 30, 30));
ui.painter().rect_filled(search_rect, 0.0, bg_color);
@@ -1366,9 +1386,9 @@ impl AssetLibraryPane {
let list_selected = self.view_mode == AssetViewMode::List;
let list_response = ui.allocate_rect(list_button_rect, egui::Sense::click());
let list_bg = if list_selected {
egui::Color32::from_rgb(70, 90, 110)
shared.theme.bg_color(&["#asset-library", ".view-toggle", ".selected"], ui.ctx(), egui::Color32::from_rgb(70, 90, 110))
} else if list_response.hovered() {
egui::Color32::from_rgb(50, 50, 50)
shared.theme.bg_color(&["#asset-library", ".view-toggle", ".hover"], ui.ctx(), egui::Color32::from_rgb(50, 50, 50))
} else {
egui::Color32::TRANSPARENT
};
@@ -1376,9 +1396,9 @@ impl AssetLibraryPane {
// Draw list icon (three horizontal lines)
let list_icon_color = if list_selected {
egui::Color32::WHITE
shared.theme.text_color(&["#asset-library", ".view-toggle", ".selected"], ui.ctx(), egui::Color32::WHITE)
} else {
egui::Color32::from_gray(150)
shared.theme.text_color(&["#asset-library", ".view-toggle"], ui.ctx(), egui::Color32::from_gray(150))
};
let line_spacing = 4.0;
let line_width = 10.0;
@@ -1402,9 +1422,9 @@ impl AssetLibraryPane {
let grid_selected = self.view_mode == AssetViewMode::Grid;
let grid_response = ui.allocate_rect(grid_button_rect, egui::Sense::click());
let grid_bg = if grid_selected {
egui::Color32::from_rgb(70, 90, 110)
shared.theme.bg_color(&["#asset-library", ".view-toggle", ".selected"], ui.ctx(), egui::Color32::from_rgb(70, 90, 110))
} else if grid_response.hovered() {
egui::Color32::from_rgb(50, 50, 50)
shared.theme.bg_color(&["#asset-library", ".view-toggle", ".hover"], ui.ctx(), egui::Color32::from_rgb(50, 50, 50))
} else {
egui::Color32::TRANSPARENT
};
@@ -1412,9 +1432,9 @@ impl AssetLibraryPane {
// Draw grid icon (2x2 squares)
let grid_icon_color = if grid_selected {
egui::Color32::WHITE
shared.theme.text_color(&["#asset-library", ".view-toggle", ".selected"], ui.ctx(), egui::Color32::WHITE)
} else {
egui::Color32::from_gray(150)
shared.theme.text_color(&["#asset-library", ".view-toggle"], ui.ctx(), egui::Color32::from_gray(150))
};
let square_size = 4.0;
let square_gap = 2.0;
@@ -1444,7 +1464,7 @@ impl AssetLibraryPane {
egui::Align2::LEFT_TOP,
"Search:",
egui::FontId::proportional(14.0),
egui::Color32::from_gray(180),
shared.theme.text_color(&["#asset-library", ".search-label"], ui.ctx(), egui::Color32::from_gray(180)),
);
// Text field using IME-safe widget (leave room for view toggle buttons)
@@ -1473,7 +1493,7 @@ impl AssetLibraryPane {
// Background
let bg_style = shared.theme.style(".panel-content", ui.ctx());
let bg_color = bg_style
.background_color
.background_color()
.unwrap_or(egui::Color32::from_rgb(40, 40, 40));
ui.painter().rect_filled(tabs_rect, 0.0, bg_color);
@@ -1490,7 +1510,7 @@ impl AssetLibraryPane {
// Tab background
let tab_bg = if is_selected {
egui::Color32::from_rgb(60, 60, 60)
shared.theme.bg_color(&["#asset-library", ".category-tab", ".selected"], ui.ctx(), egui::Color32::from_rgb(60, 60, 60))
} else {
egui::Color32::TRANSPARENT
};
@@ -1508,7 +1528,7 @@ impl AssetLibraryPane {
let text_color = if is_selected {
indicator_color
} else {
egui::Color32::from_gray(150)
shared.theme.text_color(&["#asset-library", ".category-tab"], ui.ctx(), egui::Color32::from_gray(150))
};
ui.painter().text(
@@ -1552,7 +1572,7 @@ impl AssetLibraryPane {
// Background
let bg_style = shared.theme.style(".panel-header", ui.ctx());
let bg_color = bg_style
.background_color
.background_color()
.unwrap_or(egui::Color32::from_rgb(25, 25, 25));
ui.painter().rect_filled(rect, 0.0, bg_color);
@@ -1600,11 +1620,11 @@ impl AssetLibraryPane {
// Determine color based on state
let text_color = if is_last {
egui::Color32::WHITE
shared.theme.text_color(&["#asset-library", ".breadcrumb", ".active"], ui.ctx(), egui::Color32::WHITE)
} else if response.hovered() {
egui::Color32::from_rgb(100, 150, 255)
shared.theme.text_color(&["#asset-library", ".breadcrumb", ".hover"], ui.ctx(), egui::Color32::from_rgb(100, 150, 255))
} else {
egui::Color32::from_rgb(150, 150, 150)
shared.theme.text_color(&["#asset-library", ".breadcrumb"], ui.ctx(), egui::Color32::from_rgb(150, 150, 150))
};
// Draw text
@@ -1639,7 +1659,7 @@ impl AssetLibraryPane {
egui::Align2::LEFT_CENTER,
">",
egui::FontId::proportional(12.0),
egui::Color32::from_rgb(100, 100, 100),
shared.theme.text_color(&["#asset-library", ".breadcrumb-separator"], ui.ctx(), egui::Color32::from_rgb(100, 100, 100)),
);
x_offset += 16.0;
}
@@ -1718,15 +1738,7 @@ impl AssetLibraryPane {
let is_being_dragged = shared.dragging_asset.as_ref().map(|d| d.clip_id == asset.id).unwrap_or(false);
// Item background
let item_bg = if is_being_dragged {
egui::Color32::from_rgb(80, 100, 120)
} else if is_selected {
egui::Color32::from_rgb(60, 80, 100)
} else if response.hovered() {
egui::Color32::from_rgb(45, 45, 45)
} else {
egui::Color32::from_rgb(35, 35, 35)
};
let item_bg = item_state_bg(shared.theme, ui.ctx(), "#asset-library", is_being_dragged, is_selected, response.hovered());
ui.painter().rect_filled(item_rect, 4.0, item_bg);
// Thumbnail area
@@ -1960,12 +1972,11 @@ impl AssetLibraryPane {
// Background
let bg_color = if is_drop_hover {
// Highlight as drop target
egui::Color32::from_rgb(60, 100, 140)
shared.theme.bg_color(&["#asset-library", ".folder-item", ".drop-target"], ui.ctx(), egui::Color32::from_rgb(60, 100, 140))
} else if response.hovered() {
egui::Color32::from_rgb(50, 50, 50)
shared.theme.bg_color(&["#asset-library", ".folder-item", ".hover"], ui.ctx(), egui::Color32::from_rgb(50, 50, 50))
} else {
egui::Color32::from_rgb(35, 35, 35)
shared.theme.bg_color(&["#asset-library", ".folder-item"], ui.ctx(), egui::Color32::from_rgb(35, 35, 35))
};
ui.painter().rect_filled(item_rect, 0.0, bg_color);
@@ -1974,7 +1985,7 @@ impl AssetLibraryPane {
ui.painter().rect_stroke(
item_rect,
0.0,
egui::Stroke::new(2.0, egui::Color32::from_rgb(100, 180, 255)),
egui::Stroke::new(2.0, shared.theme.border_color(&["#asset-library", ".folder-item", ".drop-target"], ui.ctx(), egui::Color32::from_rgb(100, 180, 255))),
egui::StrokeKind::Middle,
);
}
@@ -2018,7 +2029,7 @@ impl AssetLibraryPane {
egui::Align2::LEFT_CENTER,
&folder.name,
egui::FontId::proportional(13.0),
egui::Color32::WHITE,
shared.theme.text_color(&["#asset-library", ".folder-item", ".name"], ui.ctx(), egui::Color32::WHITE),
);
}
@@ -2029,7 +2040,7 @@ impl AssetLibraryPane {
egui::Align2::RIGHT_CENTER,
count_text,
egui::FontId::proportional(11.0),
egui::Color32::from_rgb(150, 150, 150),
shared.theme.text_color(&["#asset-library", ".folder-item", ".count"], ui.ctx(), egui::Color32::from_rgb(150, 150, 150)),
);
// Handle drop: move asset to folder
@@ -2131,12 +2142,11 @@ impl AssetLibraryPane {
// Background
let bg_color = if is_drop_hover {
// Highlight as drop target
egui::Color32::from_rgb(60, 100, 140)
shared.theme.bg_color(&["#asset-library", ".folder-item", ".drop-target"], ui.ctx(), egui::Color32::from_rgb(60, 100, 140))
} else if response.hovered() {
egui::Color32::from_rgb(50, 50, 50)
shared.theme.bg_color(&["#asset-library", ".folder-item", ".hover"], ui.ctx(), egui::Color32::from_rgb(50, 50, 50))
} else {
egui::Color32::from_rgb(35, 35, 35)
shared.theme.bg_color(&["#asset-library", ".folder-item"], ui.ctx(), egui::Color32::from_rgb(35, 35, 35))
};
ui.painter().rect_filled(rect, 4.0, bg_color);
@@ -2145,7 +2155,7 @@ impl AssetLibraryPane {
ui.painter().rect_stroke(
rect,
4.0,
egui::Stroke::new(2.0, egui::Color32::from_rgb(100, 180, 255)),
egui::Stroke::new(2.0, shared.theme.border_color(&["#asset-library", ".folder-item", ".drop-target"], ui.ctx(), egui::Color32::from_rgb(100, 180, 255))),
egui::StrokeKind::Middle,
);
}
@@ -2176,7 +2186,7 @@ impl AssetLibraryPane {
egui::Align2::CENTER_CENTER,
name,
egui::FontId::proportional(10.0),
egui::Color32::WHITE,
shared.theme.text_color(&["#asset-library", ".folder-item", ".name"], ui.ctx(), egui::Color32::WHITE),
);
// Item count
@@ -2185,7 +2195,7 @@ impl AssetLibraryPane {
egui::Align2::CENTER_CENTER,
format!("{} items", folder.item_count),
egui::FontId::proportional(9.0),
egui::Color32::from_rgb(150, 150, 150),
shared.theme.text_color(&["#asset-library", ".folder-item", ".count"], ui.ctx(), egui::Color32::from_rgb(150, 150, 150)),
);
// Handle drop: move asset to folder
@@ -2251,19 +2261,11 @@ impl AssetLibraryPane {
.unwrap_or(false);
// Text colors
let text_color = egui::Color32::from_gray(200);
let secondary_text_color = egui::Color32::from_gray(120);
let text_color = shared.theme.text_color(&["#asset-library", ".text-primary"], ui.ctx(), egui::Color32::from_gray(200));
let secondary_text_color = shared.theme.text_color(&["#asset-library", ".text-secondary"], ui.ctx(), egui::Color32::from_gray(120));
// Item background
let item_bg = if is_being_dragged {
egui::Color32::from_rgb(80, 100, 120)
} else if is_selected {
egui::Color32::from_rgb(60, 80, 100)
} else if response.hovered() {
egui::Color32::from_rgb(45, 45, 45)
} else {
egui::Color32::from_rgb(35, 35, 35)
};
let item_bg = item_state_bg(shared.theme, ui.ctx(), "#asset-library", is_being_dragged, is_selected, response.hovered());
ui.painter().rect_filled(item_rect, 3.0, item_bg);
// Category color indicator bar
@@ -2437,15 +2439,7 @@ impl AssetLibraryPane {
.unwrap_or(false);
// Background
let bg_color = if is_being_dragged {
egui::Color32::from_rgb(80, 100, 120)
} else if is_selected {
egui::Color32::from_rgb(60, 80, 100)
} else if response.hovered() {
egui::Color32::from_rgb(50, 50, 50)
} else {
egui::Color32::from_rgb(35, 35, 35)
};
let bg_color = item_state_bg(shared.theme, ui.ctx(), "#asset-library", is_being_dragged, is_selected, response.hovered());
ui.painter().rect_filled(rect, 4.0, bg_color);
// Thumbnail
@@ -2617,7 +2611,7 @@ impl AssetLibraryPane {
// Background
let bg_style = shared.theme.style(".panel-content", ui.ctx());
let bg_color = bg_style
.background_color
.background_color()
.unwrap_or(egui::Color32::from_rgb(25, 25, 25));
ui.painter().rect_filled(rect, 0.0, bg_color);
@@ -2722,15 +2716,7 @@ impl AssetLibraryPane {
.unwrap_or(false);
// Item background
let item_bg = if is_being_dragged {
egui::Color32::from_rgb(80, 100, 120) // Highlight when dragging
} else if is_selected {
egui::Color32::from_rgb(60, 80, 100)
} else if response.hovered() {
egui::Color32::from_rgb(45, 45, 45)
} else {
egui::Color32::from_rgb(35, 35, 35)
};
let item_bg = item_state_bg(shared.theme, ui.ctx(), "#asset-library", is_being_dragged, is_selected, response.hovered());
ui.painter().rect_filled(item_rect, 3.0, item_bg);
// Category color indicator bar
@@ -3030,7 +3016,7 @@ impl AssetLibraryPane {
// Background
let bg_style = shared.theme.style(".panel-content", ui.ctx());
let bg_color = bg_style
.background_color
.background_color()
.unwrap_or(egui::Color32::from_rgb(25, 25, 25));
ui.painter().rect_filled(rect, 0.0, bg_color);
@@ -881,11 +881,8 @@ impl PaneRenderer for InfopanelPane {
shared: &mut SharedPaneState,
) {
// Background
ui.painter().rect_filled(
rect,
0.0,
egui::Color32::from_rgb(30, 35, 40),
);
let bg = shared.theme.bg_color(&["#infopanel", ".pane-content"], ui.ctx(), egui::Color32::from_rgb(30, 35, 40));
ui.painter().rect_filled(rect, 0.0, bg);
// Create scrollable area for content
let content_rect = rect.shrink(8.0);
@@ -515,6 +515,8 @@ impl NodeTemplateTrait for NodeTemplate {
ValueType::float_param(0.7, 0.0, 1.0, "", 2, None), InputParamKind::ConstantOnly, true);
graph.add_input_param(node_id, "Release".into(), DataType::CV,
ValueType::float_param(0.2, 0.001, 5.0, " s", 3, None), InputParamKind::ConstantOnly, true);
graph.add_input_param(node_id, "Curve".into(), DataType::CV,
ValueType::float_param(0.0, 0.0, 1.0, "", 4, Some(&["Linear", "Exponential"])), InputParamKind::ConstantOnly, true);
graph.add_output_param(node_id, "Envelope Out".into(), DataType::CV);
}
NodeTemplate::Lfo => {
@@ -2269,12 +2269,12 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
if self.track_id.is_none() || self.backend.is_none() {
// Show message that no valid track is selected
let painter = ui.painter();
let bg_color = egui::Color32::from_gray(30);
let bg_color = shared.theme.bg_color(&["#node-editor", ".pane-content"], ui.ctx(), egui::Color32::from_gray(30));
painter.rect_filled(rect, 0.0, bg_color);
let text = "Select a MIDI or Audio track to view its node graph";
let font_id = egui::FontId::proportional(16.0);
let text_color = egui::Color32::from_gray(150);
let text_color = shared.theme.text_color(&["#node-editor", ".text-secondary"], ui.ctx(), egui::Color32::from_gray(150));
let galley = painter.layout_no_wrap(text.to_string(), font_id, text_color);
let text_pos = rect.center() - galley.size() / 2.0;
@@ -2351,8 +2351,8 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
let bg_style = shared.theme.style(".node-graph-background", ui.ctx());
let grid_style = shared.theme.style(".node-graph-grid", ui.ctx());
let bg_color = bg_style.background_color.unwrap_or(egui::Color32::from_gray(45));
let grid_color = grid_style.background_color.unwrap_or(egui::Color32::from_gray(55));
let bg_color = bg_style.background_color().unwrap_or(egui::Color32::from_gray(45));
let grid_color = grid_style.background_color().unwrap_or(egui::Color32::from_gray(55));
// Draw breadcrumb bar when editing a subgraph
let breadcrumb_height = if self.in_subgraph() { 28.0 } else { 0.0 };
@@ -2363,10 +2363,12 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
egui::vec2(rect.width(), breadcrumb_height),
);
let painter = ui.painter();
painter.rect_filled(breadcrumb_rect, 0.0, egui::Color32::from_gray(35));
let bc_bg = shared.theme.bg_color(&["#node-editor", ".pane-header"], ui.ctx(), egui::Color32::from_gray(35));
painter.rect_filled(breadcrumb_rect, 0.0, bc_bg);
let bc_border = shared.theme.border_color(&["#node-editor", ".pane-header"], ui.ctx(), egui::Color32::from_gray(60));
painter.line_segment(
[breadcrumb_rect.left_bottom(), breadcrumb_rect.right_bottom()],
egui::Stroke::new(1.0, egui::Color32::from_gray(60)),
egui::Stroke::new(1.0, bc_border),
);
// Draw clickable breadcrumb segments
@@ -2378,9 +2380,9 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
for (i, segment) in segments.iter().enumerate() {
let is_last = i == segments.len() - 1;
let text_color = if is_last {
egui::Color32::from_gray(220)
shared.theme.text_color(&["#node-editor", ".text-primary"], ui.ctx(), egui::Color32::from_gray(220))
} else {
egui::Color32::from_rgb(100, 180, 255)
shared.theme.text_color(&["#node-editor", ".text-secondary"], ui.ctx(), egui::Color32::from_rgb(100, 180, 255))
};
let font_id = egui::FontId::proportional(13.0);
@@ -2497,42 +2499,14 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
.collect();
self.user_state.available_scripts.sort_by(|a, b| a.1.to_lowercase().cmp(&b.1.to_lowercase()));
// Bundled NAM models — discover once and cache
// Bundled NAM models — populate from embedded registry
if self.user_state.available_nam_models.is_empty() {
let bundled_dirs = [
std::env::current_exe().ok()
.and_then(|p| p.parent().map(|d| d.join("models")))
.unwrap_or_default(),
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../vendor/NeuralAudio/Utils/Models"),
];
for dir in &bundled_dirs {
if let Ok(canon) = dir.canonicalize() {
if canon.is_dir() {
for entry in std::fs::read_dir(&canon).into_iter().flatten().flatten() {
let path = entry.path();
if path.extension().map_or(false, |e| e == "nam") {
let stem = path.file_stem()
.map(|s| s.to_string_lossy().to_string())
.unwrap_or_default();
// Skip LSTM variants (performance alternates, not separate amps)
if stem.ends_with("-LSTM") {
continue;
}
// Clean up display name: remove "-WaveNet" suffix
let name = stem.strip_suffix("-WaveNet")
.unwrap_or(&stem)
.to_string();
self.user_state.available_nam_models.push(NamModelInfo {
name,
path: path.to_string_lossy().to_string(),
is_bundled: true,
});
}
}
break; // use first directory found
}
}
for name in daw_backend::audio::node_graph::nodes::bundled_models::bundled_model_names() {
self.user_state.available_nam_models.push(NamModelInfo {
name: name.to_string(),
path: format!("bundled:{}", name),
is_bundled: true,
});
}
self.user_state.available_nam_models.sort_by(|a, b| a.name.cmp(&b.name));
}
@@ -22,22 +22,20 @@ impl PaneRenderer for OutlinerPane {
ui: &mut egui::Ui,
rect: egui::Rect,
_path: &NodePath,
_shared: &mut SharedPaneState,
shared: &mut SharedPaneState,
) {
// Placeholder rendering
ui.painter().rect_filled(
rect,
0.0,
egui::Color32::from_rgb(40, 50, 30),
);
let bg = shared.theme.bg_color(&["#outliner", ".pane-content"], ui.ctx(), egui::Color32::from_rgb(40, 50, 30));
ui.painter().rect_filled(rect, 0.0, bg);
let text = "Outliner\n(TODO: Implement layer tree)";
let text_color = shared.theme.text_color(&["#outliner", ".text-secondary"], ui.ctx(), egui::Color32::from_gray(150));
ui.painter().text(
rect.center(),
egui::Align2::CENTER_CENTER,
text,
egui::FontId::proportional(16.0),
egui::Color32::from_gray(150),
text_color,
);
}
@@ -290,7 +290,8 @@ impl PianoRollPane {
let painter = ui.painter_at(rect);
// Background
painter.rect_filled(rect, 0.0, Color32::from_rgb(30, 30, 35));
let bg = shared.theme.bg_color(&["#piano-roll", ".pane-content"], ui.ctx(), Color32::from_rgb(30, 30, 35));
painter.rect_filled(rect, 0.0, bg);
// Render grid (clipped to grid area)
let grid_painter = ui.painter_at(grid_rect);
@@ -1450,7 +1451,8 @@ impl PianoRollPane {
let painter = ui.painter_at(rect);
// Background
painter.rect_filled(rect, 0.0, Color32::from_rgb(20, 20, 25));
let spec_bg = shared.theme.bg_color(&["#piano-roll", ".pane-content"], ui.ctx(), Color32::from_rgb(20, 20, 25));
painter.rect_filled(rect, 0.0, spec_bg);
// Dot grid background (visible where the spectrogram doesn't draw)
let grid_painter = ui.painter_at(view_rect);
@@ -1633,10 +1635,14 @@ impl PianoRollPane {
impl PaneRenderer for PianoRollPane {
fn render_header(&mut self, ui: &mut egui::Ui, shared: &mut SharedPaneState) -> bool {
ui.horizontal(|ui| {
let header_text = shared.theme.text_color(&["#piano-roll", ".pane-header"], ui.ctx(), Color32::from_gray(180));
let header_secondary = shared.theme.text_color(&["#piano-roll", ".text-secondary"], ui.ctx(), Color32::from_gray(140));
let header_accent = shared.theme.text_color(&["#piano-roll", ".status-success"], ui.ctx(), Color32::from_rgb(143, 252, 143));
// Pane title
ui.label(
egui::RichText::new("Piano Roll")
.color(Color32::from_gray(180))
.color(header_text)
.size(11.0),
);
ui.separator();
@@ -1644,7 +1650,7 @@ impl PaneRenderer for PianoRollPane {
// Zoom
ui.label(
egui::RichText::new(format!("{:.0}px/s", self.pixels_per_second))
.color(Color32::from_gray(140))
.color(header_secondary)
.size(10.0),
);
@@ -1653,7 +1659,7 @@ impl PaneRenderer for PianoRollPane {
ui.separator();
ui.label(
egui::RichText::new(format!("{} selected", self.selected_note_indices.len()))
.color(Color32::from_rgb(143, 252, 143))
.color(header_accent)
.size(10.0),
);
}
@@ -1669,7 +1675,7 @@ impl PaneRenderer for PianoRollPane {
let n = &resolved[idx];
ui.label(
egui::RichText::new(format!("{} vel:{}", Self::note_name(n.note), n.velocity))
.color(Color32::from_gray(140))
.color(header_secondary)
.size(10.0),
);
}
@@ -1691,7 +1697,7 @@ impl PaneRenderer for PianoRollPane {
ui.separator();
ui.label(
egui::RichText::new("Gamma")
.color(Color32::from_gray(140))
.color(header_secondary)
.size(10.0),
);
ui.add(
@@ -338,7 +338,7 @@ impl PaneRenderer for PresetBrowserPane {
// Background
let bg_style = shared.theme.style(".pane-content", ui.ctx());
let bg_color = bg_style.background_color.unwrap_or(egui::Color32::from_rgb(47, 47, 47));
let bg_color = bg_style.background_color().unwrap_or(egui::Color32::from_rgb(47, 47, 47));
ui.painter().rect_filled(rect, 0.0, bg_color);
let text_color = shared.theme.style(".text-primary", ui.ctx())
@@ -744,7 +744,8 @@ impl PaneRenderer for ShaderEditorPane {
}
// Background
ui.painter().rect_filled(rect, 0.0, egui::Color32::from_rgb(25, 25, 30));
let bg = shared.theme.bg_color(&["#shader-editor", ".pane-content"], ui.ctx(), egui::Color32::from_rgb(25, 25, 30));
ui.painter().rect_filled(rect, 0.0, bg);
let content_rect = rect.shrink(8.0);
let mut content_ui = ui.new_child(
@@ -8210,13 +8210,14 @@ impl PaneRenderer for StagePane {
ui.painter().add(cb);
// Show camera info overlay
let info_color = shared.theme.text_color(&["#stage", ".text-secondary"], ui.ctx(), egui::Color32::from_gray(200));
ui.painter().text(
rect.min + egui::vec2(10.0, 10.0),
egui::Align2::LEFT_TOP,
format!("Vello Stage (zoom: {:.2}, pan: {:.0},{:.0})",
self.zoom, self.pan_offset.x, self.pan_offset.y),
egui::FontId::proportional(14.0),
egui::Color32::from_gray(200),
info_color,
);
// Render breadcrumb navigation when inside a movie clip
@@ -462,6 +462,21 @@ fn find_sampled_audio_track_for_clip(
None
}
/// Get layer type display name and color for an AnyLayer
fn layer_type_info(layer: &AnyLayer) -> (&'static str, egui::Color32) {
match layer {
AnyLayer::Vector(_) => ("Vector", egui::Color32::from_rgb(255, 180, 100)),
AnyLayer::Audio(al) => match al.audio_layer_type {
AudioLayerType::Midi => ("MIDI", egui::Color32::from_rgb(100, 255, 150)),
AudioLayerType::Sampled => ("Audio", egui::Color32::from_rgb(100, 180, 255)),
},
AnyLayer::Video(_) => ("Video", egui::Color32::from_rgb(180, 100, 255)),
AnyLayer::Effect(_) => ("Effect", egui::Color32::from_rgb(255, 100, 180)),
AnyLayer::Group(_) => ("Group", egui::Color32::from_rgb(0, 180, 180)),
AnyLayer::Raster(_) => ("Raster", egui::Color32::from_rgb(160, 100, 200)),
}
}
impl TimelinePane {
pub fn new() -> Self {
Self {
@@ -1008,7 +1023,7 @@ impl TimelinePane {
// Background
let bg_style = theme.style(".timeline-background", ui.ctx());
let bg_color = bg_style.background_color.unwrap_or(egui::Color32::from_rgb(34, 34, 34));
let bg_color = bg_style.background_color().unwrap_or(egui::Color32::from_rgb(34, 34, 34));
painter.rect_filled(rect, 0.0, bg_color);
let text_style = theme.style(".text-primary", ui.ctx());
@@ -1027,7 +1042,7 @@ impl TimelinePane {
painter.line_segment(
[rect.min + egui::vec2(x, rect.height() - 10.0),
rect.min + egui::vec2(x, rect.height())],
egui::Stroke::new(1.0, egui::Color32::from_gray(100)),
egui::Stroke::new(1.0, theme.text_color(&["#timeline", ".ruler-tick"], ui.ctx(), egui::Color32::from_gray(100))),
);
painter.text(
rect.min + egui::vec2(x + 2.0, 5.0), egui::Align2::LEFT_TOP,
@@ -1041,7 +1056,7 @@ impl TimelinePane {
painter.line_segment(
[rect.min + egui::vec2(minor_x, rect.height() - 5.0),
rect.min + egui::vec2(minor_x, rect.height())],
egui::Stroke::new(1.0, egui::Color32::from_gray(60)),
egui::Stroke::new(1.0, theme.text_color(&["#timeline", ".ruler-tick-minor"], ui.ctx(), egui::Color32::from_gray(60))),
);
}
}
@@ -1111,7 +1126,7 @@ impl TimelinePane {
if x >= 0.0 && x <= rect.width() {
let painter = ui.painter();
let scrubber_style = theme.style(".timeline-scrubber", ui.ctx());
let scrubber_color = scrubber_style.background_color.unwrap_or(egui::Color32::from_rgb(204, 34, 34));
let scrubber_color = scrubber_style.background_color().unwrap_or(egui::Color32::from_rgb(204, 34, 34));
// Red vertical line
painter.line_segment(
@@ -1159,7 +1174,7 @@ impl TimelinePane {
// Get note color from theme CSS (fallback to black)
let note_style = theme.style(".timeline-midi-note", ctx);
let note_color = note_style.background_color.unwrap_or(egui::Color32::BLACK);
let note_color = note_style.background_color().unwrap_or(egui::Color32::BLACK);
// Build a map of active notes (note_number -> note_on_timestamp)
// to calculate durations when we encounter note-offs
@@ -1269,7 +1284,7 @@ impl TimelinePane {
) {
// Background for header column
let header_style = theme.style(".timeline-header", ui.ctx());
let header_bg = header_style.background_color.unwrap_or(egui::Color32::from_rgb(17, 17, 17));
let header_bg = header_style.background_color().unwrap_or(egui::Color32::from_rgb(17, 17, 17));
ui.painter().rect_filled(
rect,
0.0,
@@ -1279,13 +1294,14 @@ impl TimelinePane {
// Theme colors for active/inactive layers
let active_style = theme.style(".timeline-layer-active", ui.ctx());
let inactive_style = theme.style(".timeline-layer-inactive", ui.ctx());
let active_color = active_style.background_color.unwrap_or(egui::Color32::from_rgb(79, 79, 79));
let inactive_color = inactive_style.background_color.unwrap_or(egui::Color32::from_rgb(51, 51, 51));
let active_color = active_style.background_color().unwrap_or(egui::Color32::from_rgb(79, 79, 79));
let inactive_color = inactive_style.background_color().unwrap_or(egui::Color32::from_rgb(51, 51, 51));
// Get text color from theme
let text_style = theme.style(".text-primary", ui.ctx());
let text_color = text_style.text_color.unwrap_or(egui::Color32::from_gray(200));
let secondary_text_color = egui::Color32::from_gray(150);
let secondary_style = theme.style(".text-secondary", ui.ctx());
let secondary_text_color = secondary_style.text_color.unwrap_or(egui::Color32::from_gray(150));
// Build virtual row list (accounts for group expansion)
let all_rows = build_timeline_rows(context_layers);
@@ -1331,35 +1347,15 @@ impl TimelinePane {
let (layer_id, layer_name, layer_type, type_color) = match row {
TimelineRow::Normal(layer) => {
let data = layer.layer();
let (lt, tc) = match layer {
AnyLayer::Vector(_) => ("Vector", egui::Color32::from_rgb(255, 180, 100)),
AnyLayer::Audio(al) => match al.audio_layer_type {
AudioLayerType::Midi => ("MIDI", egui::Color32::from_rgb(100, 255, 150)),
AudioLayerType::Sampled => ("Audio", egui::Color32::from_rgb(100, 180, 255)),
},
AnyLayer::Video(_) => ("Video", egui::Color32::from_rgb(180, 100, 255)),
AnyLayer::Effect(_) => ("Effect", egui::Color32::from_rgb(255, 100, 180)),
AnyLayer::Group(_) => ("Group", egui::Color32::from_rgb(0, 180, 180)),
AnyLayer::Raster(_) => ("Raster", egui::Color32::from_rgb(160, 100, 200)),
};
let (lt, tc) = layer_type_info(layer);
(layer.id(), data.name.clone(), lt, tc)
}
TimelineRow::CollapsedGroup { group, .. } => {
(group.layer.id, group.layer.name.clone(), "Group", egui::Color32::from_rgb(0, 180, 180))
(group.layer.id, group.layer.name.clone(), "Group", theme.bg_color(&["#timeline", ".layer-type-group"], ui.ctx(), egui::Color32::from_rgb(0, 180, 180)))
}
TimelineRow::GroupChild { child, .. } => {
let data = child.layer();
let (lt, tc) = match child {
AnyLayer::Vector(_) => ("Vector", egui::Color32::from_rgb(255, 180, 100)),
AnyLayer::Audio(al) => match al.audio_layer_type {
AudioLayerType::Midi => ("MIDI", egui::Color32::from_rgb(100, 255, 150)),
AudioLayerType::Sampled => ("Audio", egui::Color32::from_rgb(100, 180, 255)),
},
AnyLayer::Video(_) => ("Video", egui::Color32::from_rgb(180, 100, 255)),
AnyLayer::Effect(_) => ("Effect", egui::Color32::from_rgb(255, 100, 180)),
AnyLayer::Group(_) => ("Group", egui::Color32::from_rgb(0, 180, 180)),
AnyLayer::Raster(_) => ("Raster", egui::Color32::from_rgb(160, 100, 200)),
};
let (lt, tc) = layer_type_info(child);
(child.id(), data.name.clone(), lt, tc)
}
};
@@ -1388,7 +1384,7 @@ impl TimelinePane {
let group_color = match row {
TimelineRow::GroupChild { .. } | TimelineRow::CollapsedGroup { .. } => {
// Solid dark teal for the group gutter
egui::Color32::from_rgb(0, 50, 50)
theme.bg_color(&["#timeline", ".group-gutter"], ui.ctx(), egui::Color32::from_rgb(0, 50, 50))
}
_ => header_bg,
};
@@ -1399,7 +1395,7 @@ impl TimelinePane {
egui::pos2(header_rect.min.x + indent - 2.0, y),
egui::vec2(2.0, LAYER_HEIGHT),
);
ui.painter().rect_filled(accent_rect, 0.0, egui::Color32::from_rgb(0, 180, 180));
ui.painter().rect_filled(accent_rect, 0.0, theme.bg_color(&["#timeline", ".group-accent"], ui.ctx(), egui::Color32::from_rgb(0, 180, 180)));
// Draw collapse triangle on first child row (painted, not text)
if let TimelineRow::GroupChild { show_collapse: true, .. } = row {
@@ -1412,7 +1408,7 @@ impl TimelinePane {
egui::pos2(cx + s, cy - s * 0.6),
egui::pos2(cx, cy + s * 0.6),
];
ui.painter().add(egui::Shape::convex_polygon(tri, egui::Color32::from_gray(180), egui::Stroke::NONE));
ui.painter().add(egui::Shape::convex_polygon(tri, theme.text_color(&["#timeline", ".collapse-triangle"], ui.ctx(), egui::Color32::from_gray(180)), egui::Stroke::NONE));
}
// Make the ENTIRE gutter clickable for collapse on any GroupChild row
@@ -1448,7 +1444,7 @@ impl TimelinePane {
egui::pos2(cx - s * 0.6, cy + s),
egui::pos2(cx + s * 0.6, cy),
];
ui.painter().add(egui::Shape::convex_polygon(tri, egui::Color32::from_gray(180), egui::Stroke::NONE));
ui.painter().add(egui::Shape::convex_polygon(tri, theme.text_color(&["#timeline", ".collapse-triangle"], ui.ctx(), egui::Color32::from_gray(180)), egui::Stroke::NONE));
// Clickable area for expand
let chevron_rect = egui::Rect::from_min_size(
@@ -1562,9 +1558,9 @@ impl TimelinePane {
let cam_text = if camera_enabled { "📹" } else { "📷" };
let button = egui::Button::new(cam_text)
.fill(if camera_enabled {
egui::Color32::from_rgba_unmultiplied(100, 200, 100, 100)
theme.bg_color(&["#timeline", ".btn-toggle", ".active"], ui.ctx(), egui::Color32::from_rgba_unmultiplied(100, 200, 100, 100))
} else {
egui::Color32::from_gray(40)
theme.bg_color(&["#timeline", ".btn-toggle"], ui.ctx(), egui::Color32::from_gray(40))
})
.stroke(egui::Stroke::NONE);
ui.add(button)
@@ -1573,9 +1569,9 @@ impl TimelinePane {
let mute_text = if is_muted { "🔇" } else { "🔊" };
let button = egui::Button::new(mute_text)
.fill(if is_muted {
egui::Color32::from_rgba_unmultiplied(255, 100, 100, 100)
theme.bg_color(&["#timeline", ".btn-mute", ".active"], ui.ctx(), egui::Color32::from_rgba_unmultiplied(255, 100, 100, 100))
} else {
egui::Color32::from_gray(40)
theme.bg_color(&["#timeline", ".btn-toggle"], ui.ctx(), egui::Color32::from_gray(40))
})
.stroke(egui::Stroke::NONE);
ui.add(button)
@@ -1606,9 +1602,9 @@ impl TimelinePane {
let solo_response = ui.scope_builder(egui::UiBuilder::new().max_rect(solo_button_rect), |ui| {
let button = egui::Button::new("🎧")
.fill(if is_soloed {
egui::Color32::from_rgba_unmultiplied(100, 200, 100, 100)
theme.bg_color(&["#timeline", ".btn-solo", ".active"], ui.ctx(), egui::Color32::from_rgba_unmultiplied(100, 200, 100, 100))
} else {
egui::Color32::from_gray(40)
theme.bg_color(&["#timeline", ".btn-toggle"], ui.ctx(), egui::Color32::from_gray(40))
})
.stroke(egui::Stroke::NONE);
ui.add(button)
@@ -1630,9 +1626,9 @@ impl TimelinePane {
let lock_text = if is_locked { "🔒" } else { "🔓" };
let button = egui::Button::new(lock_text)
.fill(if is_locked {
egui::Color32::from_rgba_unmultiplied(200, 150, 100, 100)
theme.bg_color(&["#timeline", ".btn-lock", ".active"], ui.ctx(), egui::Color32::from_rgba_unmultiplied(200, 150, 100, 100))
} else {
egui::Color32::from_gray(40)
theme.bg_color(&["#timeline", ".btn-toggle"], ui.ctx(), egui::Color32::from_gray(40))
})
.stroke(egui::Stroke::NONE);
ui.add(button)
@@ -1732,7 +1728,7 @@ impl TimelinePane {
egui::Align2::CENTER_CENTER,
"Gain",
egui::FontId::proportional(9.0),
egui::Color32::from_gray(140),
theme.text_color(&["#timeline", ".gain-label"], ui.ctx(), egui::Color32::from_gray(140)),
);
}
}
@@ -1763,11 +1759,11 @@ impl TimelinePane {
let clamped = level.min(1.0);
let filled_width = meter_rect.width() * clamped;
let color = if clamped > 0.9 {
egui::Color32::from_rgb(220, 50, 50)
theme.bg_color(&["#timeline", ".vu-meter", ".clip"], ui.ctx(), egui::Color32::from_rgb(220, 50, 50))
} else if clamped > 0.7 {
egui::Color32::from_rgb(220, 200, 50)
theme.bg_color(&["#timeline", ".vu-meter", ".warn"], ui.ctx(), egui::Color32::from_rgb(220, 200, 50))
} else {
egui::Color32::from_rgb(50, 200, 80)
theme.bg_color(&["#timeline", ".vu-meter", ".normal"], ui.ctx(), egui::Color32::from_rgb(50, 200, 80))
};
let filled = egui::Rect::from_min_size(
meter_rect.left_top(),
@@ -1783,7 +1779,7 @@ impl TimelinePane {
egui::pos2(header_rect.min.x, header_rect.max.y),
egui::pos2(header_rect.max.x, header_rect.max.y),
],
egui::Stroke::new(1.0, egui::Color32::from_gray(20)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".separator"], ui.ctx(), egui::Color32::from_gray(20))),
);
}
@@ -1817,34 +1813,14 @@ impl TimelinePane {
};
let (drag_name, drag_type_str, drag_type_color) = match dragged_row {
TimelineRow::Normal(layer) => {
let (lt, tc) = match layer {
AnyLayer::Vector(_) => ("Vector", egui::Color32::from_rgb(255, 180, 100)),
AnyLayer::Audio(al) => match al.audio_layer_type {
AudioLayerType::Midi => ("MIDI", egui::Color32::from_rgb(100, 255, 150)),
AudioLayerType::Sampled => ("Audio", egui::Color32::from_rgb(100, 180, 255)),
},
AnyLayer::Video(_) => ("Video", egui::Color32::from_rgb(180, 100, 255)),
AnyLayer::Effect(_) => ("Effect", egui::Color32::from_rgb(255, 100, 180)),
AnyLayer::Group(_) => ("Group", egui::Color32::from_rgb(0, 180, 180)),
AnyLayer::Raster(_) => ("Raster", egui::Color32::from_rgb(100, 200, 255)),
};
let (lt, tc) = layer_type_info(layer);
(layer.layer().name.clone(), lt, tc)
}
TimelineRow::CollapsedGroup { group, .. } => {
(group.layer.name.clone(), "Group", egui::Color32::from_rgb(0, 180, 180))
(group.layer.name.clone(), "Group", theme.bg_color(&["#timeline", ".layer-type-group"], ui.ctx(), egui::Color32::from_rgb(0, 180, 180)))
}
TimelineRow::GroupChild { child, .. } => {
let (lt, tc) = match child {
AnyLayer::Vector(_) => ("Vector", egui::Color32::from_rgb(255, 180, 100)),
AnyLayer::Audio(al) => match al.audio_layer_type {
AudioLayerType::Midi => ("MIDI", egui::Color32::from_rgb(100, 255, 150)),
AudioLayerType::Sampled => ("Audio", egui::Color32::from_rgb(100, 180, 255)),
},
AnyLayer::Video(_) => ("Video", egui::Color32::from_rgb(180, 100, 255)),
AnyLayer::Effect(_) => ("Effect", egui::Color32::from_rgb(255, 100, 180)),
AnyLayer::Group(_) => ("Group", egui::Color32::from_rgb(0, 180, 180)),
AnyLayer::Raster(_) => ("Raster", egui::Color32::from_rgb(100, 200, 255)),
};
let (lt, tc) = layer_type_info(child);
(child.layer().name.clone(), lt, tc)
}
};
@@ -1878,7 +1854,7 @@ impl TimelinePane {
// Separator line at bottom
ui.painter().line_segment(
[egui::pos2(float_rect.min.x, float_rect.max.y), egui::pos2(float_rect.max.x, float_rect.max.y)],
egui::Stroke::new(1.0, egui::Color32::from_gray(20)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".separator"], ui.ctx(), egui::Color32::from_gray(20))),
);
}
}
@@ -1889,7 +1865,7 @@ impl TimelinePane {
egui::pos2(rect.max.x, rect.min.y),
egui::pos2(rect.max.x, rect.max.y),
],
egui::Stroke::new(1.0, egui::Color32::from_gray(20)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".separator"], ui.ctx(), egui::Color32::from_gray(20))),
);
}
@@ -1923,8 +1899,8 @@ impl TimelinePane {
// Theme colors for active/inactive layers
let active_style = theme.style(".timeline-row-active", ui.ctx());
let inactive_style = theme.style(".timeline-row-inactive", ui.ctx());
let active_color = active_style.background_color.unwrap_or(egui::Color32::from_rgb(85, 85, 85));
let inactive_color = inactive_style.background_color.unwrap_or(egui::Color32::from_rgb(136, 136, 136));
let active_color = active_style.background_color().unwrap_or(egui::Color32::from_rgb(85, 85, 85));
let inactive_color = inactive_style.background_color().unwrap_or(egui::Color32::from_rgb(136, 136, 136));
// Build a map of clip_instance_id -> InstanceGroup for linked clip previews
let mut instance_to_group: std::collections::HashMap<uuid::Uuid, &lightningbeam_core::instance_group::InstanceGroup> = std::collections::HashMap::new();
@@ -2038,7 +2014,7 @@ impl TimelinePane {
painter.line_segment(
[egui::pos2(rect.min.x + x, y),
egui::pos2(rect.min.x + x, y + LAYER_HEIGHT)],
egui::Stroke::new(1.0, egui::Color32::from_gray(30)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".grid-line"], ui.ctx(), egui::Color32::from_gray(30))),
);
}
time += interval;
@@ -2058,7 +2034,7 @@ impl TimelinePane {
painter.line_segment(
[egui::pos2(rect.min.x + x, y),
egui::pos2(rect.min.x + x, y + LAYER_HEIGHT)],
egui::Stroke::new(if is_measure_boundary { 1.5 } else { 1.0 }, egui::Color32::from_gray(gray)),
egui::Stroke::new(if is_measure_boundary { 1.5 } else { 1.0 }, theme.border_color(&["#timeline", ".grid-line"], ui.ctx(), egui::Color32::from_gray(gray))),
);
}
}
@@ -2102,14 +2078,14 @@ impl TimelinePane {
let any_selected = child_clips.iter().any(|(_, ci)| selection.contains_clip_instance(&ci.id));
// Draw each merged span as a teal bar (brighter when selected)
let teal = if any_selected {
egui::Color32::from_rgb(30, 190, 190)
theme.bg_color(&["#timeline", ".group-bar", ".selected"], ui.ctx(), egui::Color32::from_rgb(30, 190, 190))
} else {
egui::Color32::from_rgb(0, 150, 150)
theme.bg_color(&["#timeline", ".group-bar"], ui.ctx(), egui::Color32::from_rgb(0, 150, 150))
};
let bright_teal = if any_selected {
egui::Color32::from_rgb(150, 255, 255)
theme.text_color(&["#timeline", ".group-bar", ".selected"], ui.ctx(), egui::Color32::from_rgb(150, 255, 255))
} else {
egui::Color32::from_rgb(100, 220, 220)
theme.text_color(&["#timeline", ".group-bar"], ui.ctx(), egui::Color32::from_rgb(100, 220, 220))
};
for (s, e) in &merged {
let sx = self.time_to_x(*s);
@@ -2344,7 +2320,7 @@ impl TimelinePane {
egui::pos2(layer_rect.min.x, layer_rect.max.y),
egui::pos2(layer_rect.max.x, layer_rect.max.y),
],
egui::Stroke::new(1.0, egui::Color32::from_gray(20)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".separator"], ui.ctx(), egui::Color32::from_gray(20))),
);
continue; // Skip normal clip rendering for collapsed groups
}
@@ -2641,39 +2617,15 @@ impl TimelinePane {
let visible_end_x = end_x.min(rect.width());
// Choose color based on layer type
let (clip_color, bright_color) = match layer {
lightningbeam_core::layer::AnyLayer::Vector(_) => (
egui::Color32::from_rgb(220, 150, 80), // Orange
egui::Color32::from_rgb(255, 210, 150), // Bright orange
),
lightningbeam_core::layer::AnyLayer::Audio(audio_layer) => {
match audio_layer.audio_layer_type {
lightningbeam_core::layer::AudioLayerType::Midi => (
egui::Color32::from_rgb(100, 200, 150), // Green
egui::Color32::from_rgb(150, 255, 200), // Bright green
),
lightningbeam_core::layer::AudioLayerType::Sampled => (
egui::Color32::from_rgb(80, 150, 220), // Blue
egui::Color32::from_rgb(150, 210, 255), // Bright blue
),
}
}
lightningbeam_core::layer::AnyLayer::Video(_) => (
egui::Color32::from_rgb(150, 80, 220), // Purple
egui::Color32::from_rgb(200, 150, 255), // Bright purple
),
lightningbeam_core::layer::AnyLayer::Effect(_) => (
egui::Color32::from_rgb(220, 80, 160), // Pink
egui::Color32::from_rgb(255, 120, 200), // Bright pink
),
lightningbeam_core::layer::AnyLayer::Group(_) => (
egui::Color32::from_rgb(0, 150, 150), // Teal
egui::Color32::from_rgb(100, 220, 220), // Bright teal
),
lightningbeam_core::layer::AnyLayer::Raster(_) => (
egui::Color32::from_rgb(160, 100, 200), // Purple/violet
egui::Color32::from_rgb(200, 160, 240), // Bright purple/violet
),
let (clip_color, bright_color) = {
let (_, base_color) = layer_type_info(layer);
// Derive bright version by lightening each channel
let bright = egui::Color32::from_rgb(
(base_color.r() as u16 + 80).min(255) as u8,
(base_color.g() as u16 + 60).min(255) as u8,
(base_color.b() as u16 + 70).min(255) as u8,
);
(base_color, bright)
};
let (row, total_rows) = clip_stacking[clip_instance_index];
@@ -3142,11 +3094,11 @@ impl TimelinePane {
egui::pos2(cx, cy + size),
egui::pos2(cx - size, cy),
];
let color = egui::Color32::from_rgb(255, 220, 100);
let color = theme.bg_color(&["#timeline", ".keyframe-diamond"], ui.ctx(), egui::Color32::from_rgb(255, 220, 100));
painter.add(egui::Shape::convex_polygon(
diamond.to_vec(),
color,
egui::Stroke::new(1.0, egui::Color32::from_rgb(180, 150, 50)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".keyframe-diamond"], ui.ctx(), egui::Color32::from_rgb(180, 150, 50))),
));
}
}
@@ -3158,7 +3110,7 @@ impl TimelinePane {
egui::pos2(layer_rect.min.x, layer_rect.max.y),
egui::pos2(layer_rect.max.x, layer_rect.max.y),
],
egui::Stroke::new(1.0, egui::Color32::from_gray(20)),
egui::Stroke::new(1.0, theme.border_color(&["#timeline", ".separator"], ui.ctx(), egui::Color32::from_gray(20))),
);
}
@@ -4258,7 +4210,7 @@ impl PaneRenderer for TimelinePane {
egui::Sense::hover(),
);
// Background
ui.painter().rect_filled(meter_rect, 2.0, egui::Color32::from_gray(30));
ui.painter().rect_filled(meter_rect, 2.0, shared.theme.bg_color(&["#timeline", ".vu-meter-bg"], ui.ctx(), egui::Color32::from_gray(30)));
let levels = [shared.output_level.0.min(1.0), shared.output_level.1.min(1.0)];
for (i, &level) in levels.iter().enumerate() {
@@ -4266,11 +4218,11 @@ impl PaneRenderer for TimelinePane {
if level > 0.001 {
let filled_width = meter_rect.width() * level;
let color = if level > 0.9 {
egui::Color32::from_rgb(220, 50, 50)
shared.theme.bg_color(&["#timeline", ".vu-meter", ".clip"], ui.ctx(), egui::Color32::from_rgb(220, 50, 50))
} else if level > 0.7 {
egui::Color32::from_rgb(220, 200, 50)
shared.theme.bg_color(&["#timeline", ".vu-meter", ".warn"], ui.ctx(), egui::Color32::from_rgb(220, 200, 50))
} else {
egui::Color32::from_rgb(50, 200, 80)
shared.theme.bg_color(&["#timeline", ".vu-meter", ".normal"], ui.ctx(), egui::Color32::from_rgb(50, 200, 80))
};
let filled_rect = egui::Rect::from_min_size(
egui::pos2(meter_rect.min.x, bar_y),
@@ -4413,7 +4365,7 @@ impl PaneRenderer for TimelinePane {
// Render spacer above layer headers (same height as ruler)
let spacer_style = shared.theme.style(".timeline-spacer", ui.ctx());
let spacer_bg = spacer_style.background_color.unwrap_or(egui::Color32::from_rgb(17, 17, 17));
let spacer_bg = spacer_style.background_color().unwrap_or(egui::Color32::from_rgb(17, 17, 17));
ui.painter().rect_filled(
header_ruler_spacer,
0.0,
@@ -83,9 +83,9 @@ impl PaneRenderer for ToolbarPane {
// Button background
let bg_color = if is_selected {
egui::Color32::from_rgb(70, 100, 150) // Highlighted blue
shared.theme.bg_color(&["#toolbar", ".tool-button", ".selected"], ui.ctx(), egui::Color32::from_rgb(70, 100, 150))
} else {
egui::Color32::from_rgb(50, 50, 50)
shared.theme.bg_color(&["#toolbar", ".tool-button"], ui.ctx(), egui::Color32::from_rgb(50, 50, 50))
};
ui.painter().rect_filled(button_rect, 4.0, bg_color);
@@ -113,7 +113,7 @@ impl PaneRenderer for ToolbarPane {
];
ui.painter().add(egui::Shape::convex_polygon(
tri.to_vec(),
egui::Color32::from_gray(200),
shared.theme.text_color(&["#toolbar", ".tool-button"], ui.ctx(), egui::Color32::from_gray(200)),
egui::Stroke::NONE,
));
}
@@ -159,7 +159,7 @@ impl PaneRenderer for ToolbarPane {
ui.painter().rect_stroke(
button_rect,
4.0,
egui::Stroke::new(2.0, egui::Color32::from_gray(180)),
egui::Stroke::new(2.0, shared.theme.border_color(&["#toolbar", ".tool-button", ".hover"], ui.ctx(), egui::Color32::from_gray(180))),
egui::StrokeKind::Middle,
);
}
@@ -186,7 +186,7 @@ impl PaneRenderer for ToolbarPane {
ui.painter().rect_stroke(
button_rect,
4.0,
egui::Stroke::new(2.0, egui::Color32::from_rgb(100, 150, 255)),
egui::Stroke::new(2.0, shared.theme.border_color(&["#toolbar", ".tool-button", ".selected"], ui.ctx(), egui::Color32::from_rgb(100, 150, 255))),
egui::StrokeKind::Middle,
);
}
@@ -216,12 +216,13 @@ impl PaneRenderer for ToolbarPane {
// Raster layers label them "FG" / "BG"; vector layers label them "Stroke" / "Fill".
{
let stroke_label = if is_raster { "FG" } else { "Stroke" };
let label_color = shared.theme.text_color(&["#toolbar", ".text-secondary"], ui.ctx(), egui::Color32::from_gray(200));
ui.painter().text(
egui::pos2(color_x + fill_label_width / 2.0, y + color_button_size / 2.0),
egui::Align2::CENTER_CENTER,
stroke_label,
egui::FontId::proportional(14.0),
egui::Color32::from_gray(200),
label_color,
);
let stroke_button_rect = egui::Rect::from_min_size(
@@ -246,12 +247,13 @@ impl PaneRenderer for ToolbarPane {
// Fill/BG color swatch
{
let fill_label = if is_raster { "BG" } else { "Fill" };
let label_color = shared.theme.text_color(&["#toolbar", ".text-secondary"], ui.ctx(), egui::Color32::from_gray(200));
ui.painter().text(
egui::pos2(color_x + fill_label_width / 2.0, y + color_button_size / 2.0),
egui::Align2::CENTER_CENTER,
fill_label,
egui::FontId::proportional(14.0),
egui::Color32::from_gray(200),
label_color,
);
let fill_button_rect = egui::Rect::from_min_size(
@@ -153,6 +153,7 @@ impl VirtualPianoPane {
&self,
ui: &mut egui::Ui,
rect: egui::Rect,
shared: &SharedPaneState,
visible_start: u8,
visible_end: u8,
white_key_width: f32,
@@ -173,15 +174,16 @@ impl VirtualPianoPane {
egui::vec2(white_key_width - 1.0, white_key_height),
);
let color = if self.pressed_notes.contains(&note) {
egui::Color32::from_rgb(100, 150, 255)
shared.theme.bg_color(&[".piano-white-key", ".pressed"], ui.ctx(), egui::Color32::from_rgb(100, 150, 255))
} else {
egui::Color32::WHITE
shared.theme.bg_color(&[".piano-white-key"], ui.ctx(), egui::Color32::WHITE)
};
ui.painter().rect_filled(key_rect, 2.0, color);
let border = shared.theme.border_color(&[".piano-white-key"], ui.ctx(), egui::Color32::BLACK);
ui.painter().rect_stroke(
key_rect,
2.0,
egui::Stroke::new(1.0, egui::Color32::BLACK),
egui::Stroke::new(1.0, border),
egui::StrokeKind::Middle,
);
white_pos += 1.0;
@@ -204,9 +206,9 @@ impl VirtualPianoPane {
egui::vec2(black_key_width, black_key_height),
);
let color = if self.pressed_notes.contains(&note) {
egui::Color32::from_rgb(50, 100, 200)
shared.theme.bg_color(&[".piano-black-key", ".pressed"], ui.ctx(), egui::Color32::from_rgb(50, 100, 200))
} else {
egui::Color32::BLACK
shared.theme.bg_color(&[".piano-black-key"], ui.ctx(), egui::Color32::BLACK)
};
ui.painter().rect_filled(key_rect, 2.0, color);
}
@@ -232,7 +234,7 @@ impl VirtualPianoPane {
self.send_note_off(note, shared);
}
}
self.render_keyboard_visual_only(ui, rect, visible_start, visible_end, white_key_width, offset_x, white_key_height, black_key_width, black_key_height);
self.render_keyboard_visual_only(ui, rect, shared, visible_start, visible_end, white_key_width, offset_x, white_key_height, black_key_width, black_key_height);
return;
}
@@ -303,16 +305,17 @@ impl VirtualPianoPane {
let is_pressed = self.pressed_notes.contains(&note) ||
(!black_key_interacted && pointer_over_key && pointer_down);
let color = if is_pressed {
egui::Color32::from_rgb(100, 150, 255) // Blue when pressed
shared.theme.bg_color(&[".piano-white-key", ".pressed"], ui.ctx(), egui::Color32::from_rgb(100, 150, 255))
} else {
egui::Color32::WHITE
shared.theme.bg_color(&[".piano-white-key"], ui.ctx(), egui::Color32::WHITE)
};
ui.painter().rect_filled(key_rect, 2.0, color);
let border = shared.theme.border_color(&[".piano-white-key"], ui.ctx(), egui::Color32::BLACK);
ui.painter().rect_stroke(
key_rect,
2.0,
egui::Stroke::new(1.0, egui::Color32::BLACK),
egui::Stroke::new(1.0, border),
egui::StrokeKind::Middle,
);
@@ -386,9 +389,9 @@ impl VirtualPianoPane {
let is_pressed = self.pressed_notes.contains(&note) ||
(pointer_over_key && pointer_down);
let color = if is_pressed {
egui::Color32::from_rgb(50, 100, 200) // Darker blue when pressed
shared.theme.bg_color(&[".piano-black-key", ".pressed"], ui.ctx(), egui::Color32::from_rgb(50, 100, 200))
} else {
egui::Color32::BLACK
shared.theme.bg_color(&[".piano-black-key"], ui.ctx(), egui::Color32::BLACK)
};
ui.painter().rect_filled(key_rect, 2.0, color);
@@ -670,6 +673,7 @@ impl VirtualPianoPane {
&self,
ui: &mut egui::Ui,
rect: egui::Rect,
shared: &SharedPaneState,
visible_start: u8,
visible_end: u8,
white_key_width: f32,
@@ -707,9 +711,9 @@ impl VirtualPianoPane {
// Check if key is currently pressed
let is_pressed = self.pressed_notes.contains(&note);
let color = if is_pressed {
egui::Color32::BLACK
shared.theme.text_color(&[".piano-white-key", ".pressed"], ui.ctx(), egui::Color32::BLACK)
} else {
egui::Color32::from_gray(51) // #333333
shared.theme.text_color(&[".piano-white-key"], ui.ctx(), egui::Color32::from_gray(51))
};
ui.painter().text(
@@ -748,9 +752,9 @@ impl VirtualPianoPane {
let is_pressed = self.pressed_notes.contains(&note);
let color = if is_pressed {
egui::Color32::WHITE
shared.theme.text_color(&[".piano-black-key", ".pressed"], ui.ctx(), egui::Color32::WHITE)
} else {
egui::Color32::from_rgba_premultiplied(255, 255, 255, 178) // rgba(255,255,255,0.7)
shared.theme.text_color(&[".piano-black-key"], ui.ctx(), egui::Color32::from_rgba_premultiplied(255, 255, 255, 178))
};
ui.painter().text(
@@ -766,7 +770,7 @@ impl VirtualPianoPane {
}
impl PaneRenderer for VirtualPianoPane {
fn render_header(&mut self, ui: &mut egui::Ui, _shared: &mut SharedPaneState) -> bool {
fn render_header(&mut self, ui: &mut egui::Ui, shared: &mut SharedPaneState) -> bool {
ui.horizontal(|ui| {
ui.label("Octave Shift:");
if ui.button("-").clicked() && self.octave_offset > -2 {
@@ -795,9 +799,13 @@ impl PaneRenderer for VirtualPianoPane {
// Sustain pedal indicator
ui.label("Sustain:");
let sustain_text = if self.sustain_active {
egui::RichText::new("ON").color(egui::Color32::from_rgb(100, 200, 100))
egui::RichText::new("ON").color(
shared.theme.text_color(&[".sustain-indicator", ".active"], ui.ctx(), egui::Color32::from_rgb(100, 200, 100))
)
} else {
egui::RichText::new("OFF").color(egui::Color32::GRAY)
egui::RichText::new("OFF").color(
shared.theme.text_color(&[".sustain-indicator"], ui.ctx(), egui::Color32::GRAY)
)
};
ui.label(sustain_text);
@@ -863,7 +871,7 @@ impl PaneRenderer for VirtualPianoPane {
self.render_keyboard(ui, rect, shared);
// Render keyboard labels on top
self.render_key_labels(ui, rect, visible_start, visible_end, white_key_width, offset_x);
self.render_key_labels(ui, rect, shared, visible_start, visible_end, white_key_width, offset_x);
}
fn name(&self) -> &str {