Set a default icon for all eframe apps: a white `e` on black background (#2996)
As a user you can change this by setting `NativeOptions::icon_data`. Set it to `None` to get the default icon assigned by the OS.
This commit is contained in:
parent
856afc8f7e
commit
7b76161a6a
|
|
@ -11,7 +11,13 @@ readme = "README.md"
|
|||
repository = "https://github.com/emilk/egui/tree/master/crates/eframe"
|
||||
categories = ["gui", "game-development"]
|
||||
keywords = ["egui", "gui", "gamedev"]
|
||||
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
|
||||
include = [
|
||||
"../LICENSE-APACHE",
|
||||
"../LICENSE-MIT",
|
||||
"**/*.rs",
|
||||
"Cargo.toml",
|
||||
"data/icon.png",
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -260,10 +260,10 @@ pub struct NativeOptions {
|
|||
/// [drag_and_drop]: https://docs.rs/winit/latest/x86_64-pc-windows-msvc/winit/platform/windows/trait.WindowBuilderExtWindows.html#tymethod.with_drag_and_drop
|
||||
pub drag_and_drop_support: bool,
|
||||
|
||||
/// The application icon, e.g. in the Windows task bar etc.
|
||||
/// The application icon, e.g. in the Windows task bar or the alt-tab menu.
|
||||
///
|
||||
/// This doesn't work on Mac and on Wayland.
|
||||
/// See <https://docs.rs/winit/latest/winit/window/struct.Window.html#method.set_window_icon> for more.
|
||||
/// The default icon is a white `e` on a black background (for "egui" or "eframe").
|
||||
/// If you prefer the OS default, set this to `None`.
|
||||
pub icon_data: Option<IconData>,
|
||||
|
||||
/// The initial (inner) position of the native window in points (logical pixels).
|
||||
|
|
@ -414,8 +414,12 @@ impl Default for NativeOptions {
|
|||
#[cfg(target_os = "macos")]
|
||||
fullsize_content: false,
|
||||
|
||||
// We set a default "egui" or "eframe" icon, which is usually more distinctive than the default OS icon.
|
||||
icon_data: Some(
|
||||
IconData::try_from_png_bytes(&include_bytes!("../../data/icon.png")[..]).unwrap(),
|
||||
),
|
||||
|
||||
drag_and_drop_support: true,
|
||||
icon_data: None,
|
||||
initial_window_pos: None,
|
||||
initial_window_size: None,
|
||||
min_window_size: None,
|
||||
|
|
|
|||
|
|
@ -22,11 +22,6 @@ fn main() -> Result<(), eframe::Error> {
|
|||
|
||||
initial_window_size: Some([1280.0, 1024.0].into()),
|
||||
|
||||
icon_data: Some(
|
||||
eframe::IconData::try_from_png_bytes(&include_bytes!("../../../media/icon.png")[..])
|
||||
.unwrap(),
|
||||
),
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
renderer: eframe::Renderer::Wgpu,
|
||||
|
||||
|
|
|
|||
BIN
media/icon.png
BIN
media/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Loading…
Reference in New Issue