notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit ea952c4c58a8efb8c1216c18376fcbf17e5798e5
parent f88b6d1dd445b7c0bdec20de6ac7efc240fa9280
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 21 Mar 2024 14:28:49 +0100

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>

Diffstat:
Aassets/icons/reply-dark.png | 0
Msrc/app.rs | 35++++++++++++++---------------------
2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/assets/icons/reply-dark.png b/assets/icons/reply-dark.png Binary files differ. diff --git a/src/app.rs b/src/app.rs @@ -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() {}