Skip to content

Instantly share code, notes, and snippets.

@whoisryosuke
Created April 24, 2023 19:48
Show Gist options
  • Select an option

  • Save whoisryosuke/47398df0ddd47a4159855658e5a81760 to your computer and use it in GitHub Desktop.

Select an option

Save whoisryosuke/47398df0ddd47a4159855658e5a81760 to your computer and use it in GitHub Desktop.

Revisions

  1. whoisryosuke created this gist Apr 24, 2023.
    23 changes: 23 additions & 0 deletions transparent-egui-window.rs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    fn ui_example_system(mut contexts: EguiContexts) {
    // Set window styles
    let ctx = contexts.ctx_mut();
    let old = ctx.style().visuals.clone();
    ctx.set_visuals(egui::Visuals {
    window_fill: Color32::TRANSPARENT,
    panel_fill: Color32::TRANSPARENT,
    window_stroke: egui::Stroke {
    color: Color32::TRANSPARENT,
    width: 0.0,
    },
    window_shadow: epaint::Shadow {
    color: Color32::TRANSPARENT,
    ..old.window_shadow
    },
    ..old
    });

    // Create window + UI
    egui::Window::new("Hello").title_bar(false).show(ctx, |ui| {
    ui.label("world");
    });
    }