You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing the package name in Cargo.toml to overlay causes the window to have a black background.
To Reproduce
Steps to reproduce the behavior:
Copy the code from below or create a transparent window using Eframe and Egui
// src/main.rs#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]// hide console window on Windows in releaseuse eframe::egui;fnmain() -> eframe::Result{
env_logger::init();// Log to stderr (if you run with `RUST_LOG=debug`).let options = eframe::NativeOptions{viewport: egui::ViewportBuilder::default().with_decorations(true)// Hide the OS-specific "chrome" around the window.with_transparent(true).with_position(egui::pos2(100.,200.)).with_inner_size(egui::vec2(300.,400.)).with_always_on_top(),
..Default::default()};
eframe::run_native("My egui App",
options,Box::new(|cc| {// This gives us image support:Ok(Box::<MyApp>::default())}),)}structMyApp{name:String,}implDefaultforMyApp{fndefault() -> Self{Self{name:String::new(),}}}impl eframe::AppforMyApp{fnclear_color(&self,_visuals:&egui::Visuals) -> [f32;4]{
egui::Rgba::TRANSPARENT.to_array()// Make sure we don't paint anything behind the rounded corners}fnupdate(&mutself,ctx:&egui::Context,_frame:&mut eframe::Frame){let panel_frame = egui::Frame{fill: egui::Color32::from_rgba_premultiplied(10,10,0,5),
..Default::default()};
egui::CentralPanel::default().frame(panel_frame).show(ctx, |ui| ui.button("Click me"));}}
Describe the bug
https://github.com/user-attachments/assets/bdb24ced-e0ea-4afa-9ec5-59061014604d
Changing the package name in Cargo.toml to
overlay
causes the window to have a black background.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The created window is (semi) transparent no matter the name of my package.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: