actionbar: support both dark and light buttons

since there is no way to do icon masks, we simply use two different
textures for dark and light mode reply buttons.

I used this command to create the dark mode button:

convert reply.png -channel RGB -negate reply-dark.png

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2024-03-21 14:28:49 +01:00
parent f88b6d1dd4
commit ea952c4c58
2 changed files with 14 additions and 21 deletions

BIN
assets/icons/reply-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

View File

@ -681,23 +681,9 @@ fn render_note(
render_reltime(ui, note_cache);
});
let note_sidebar_size = 20.0;
ui.add(NoteContents::new(damus, &txn, &note, note_key));
ui.horizontal(|ui| {
let mut size = ui.available_size();
size.x -= note_sidebar_size;
let contents = NoteContents::new(damus, &txn, &note, note_key);
//let resp = render_note_contents(ui, damus, &txn, &note, note_key);
//ui.allocate_space()
//
ui.add_sized(size, contents);
collapse_state.show_body_unindented(ui, |ui| {
ui.set_width(note_sidebar_size);
render_note_actionbar(ui)
});
});
render_note_actionbar(ui);
//let header_res = ui.horizontal(|ui| {});
});
@ -716,13 +702,20 @@ fn render_note(
}
fn render_note_actionbar(ui: &mut egui::Ui) -> egui::InnerResponse<()> {
ui.vertical(|ui| {
ui.horizontal(|ui| {
let img_data = if ui.style().visuals.dark_mode {
egui::include_image!("../assets/icons/reply.png")
} else {
egui::include_image!("../assets/icons/reply-dark.png")
};
ui.spacing_mut().button_padding = egui::vec2(0.0, 0.0);
if ui
.add(
egui::Button::image(egui::Image::new(egui::include_image!(
"../assets/icons/reply.png"
)))
.fill(ui.style().visuals.panel_fill),
egui::Button::image(egui::Image::new(img_data).max_width(10.0))
//.stroke(egui::Stroke::NONE)
.frame(false)
.fill(ui.style().visuals.panel_fill),
)
.clicked()
{}