fix: alpha rendering of buttons and palettes

This commit is contained in:
CJ van den Berg 2024-11-04 23:04:05 +01:00
parent 9421f4e7f6
commit 4e1796df27
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
5 changed files with 46 additions and 10 deletions

View file

@ -76,11 +76,16 @@ pub fn layout(_: *Self, _: *Button.State(Self)) Widget.Layout {
}
pub fn render(self: *Self, btn: *Button.State(Self), theme: *const Widget.Theme) bool {
const frame = tracy.initZone(@src(), .{ .name = @typeName(@This()) ++ " render" });
defer frame.deinit();
btn.plane.set_base_style(if (btn.active) theme.editor_cursor else theme.statusbar);
const style_base = theme.statusbar;
const style_label = if (btn.active) theme.editor_cursor else style_base;
btn.plane.set_base_style(style_base);
btn.plane.erase();
btn.plane.home();
btn.plane.set_style(style_label);
if (btn.active) {
_ = btn.plane.fill_width(" ", .{}) catch {};
btn.plane.home();
}
if (tui.current().mini_mode) |_|
render_mini_mode(&btn.plane, theme)
else if (self.detailed)