feat(icon): make a somewhat fancy custom icon
cargo devel CI / cargo CI (push) Successful in 2m47s Details

This commit is contained in:
Christoph J. Scherr 2024-08-13 16:31:14 +02:00
parent 9f636e57eb
commit 11ca0d9447
9 changed files with 13 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

BIN
assets/icon-256.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

BIN
assets/icon-512.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,21 +1,15 @@
{ {
"name": "egui Template PWA", "name": "Rollator PWA",
"short_name": "egui-template-pwa", "short_name": "rollator-pwa",
"icons": [ "icons": [
{ {
"src": "./icon-256.png", "src": "./icon-256.jpg",
"sizes": "256x256", "sizes": "256x256",
"type": "image/png" "type": "image/png"
}, },
{ {
"src": "./maskable_icon_x512.png", "src": "./icon-512.jpg",
"sizes": "512x512", "sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "./icon-1024.png",
"sizes": "1024x1024",
"type": "image/png" "type": "image/png"
} }
], ],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

View File

@ -1,22 +1,26 @@
#![warn(clippy::all, rust_2018_idioms)] #![warn(clippy::all, rust_2018_idioms)]
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use eframe::icon_data::IconDataExt;
mod app; mod app;
// When compiling natively: // When compiling natively:
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result { fn main() -> eframe::Result {
use egui::IconData;
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
let icon = IconData {
rgba: include_bytes!("../assets/icon-512.jpg").into(),
width: 512,
height: 512,
};
let native_options = eframe::NativeOptions { let native_options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default() viewport: egui::ViewportBuilder::default()
.with_inner_size([400.0, 300.0]) .with_inner_size([400.0, 300.0])
.with_min_inner_size([300.0, 220.0]) .with_min_inner_size([300.0, 220.0])
.with_icon( .with_icon(icon),
// NOTE: Adding an icon is optional
eframe::icon_data::from_png_bytes(&include_bytes!("../assets/icon-256.png")[..])
.expect("Failed to load icon"),
),
..Default::default() ..Default::default()
}; };
eframe::run_native( eframe::run_native(