Merge branch 'master' into router-typesafe

This commit is contained in:
Evan Almloff committed 2023-06-28 08:56:07 -07:00
1 parent 0600a1bb49
commit 7b1f0c9412
33 files changed
+370 -303

No files matched your search

+10
View File
@@ -23,6 +23,7 @@ pub struct Config {
pub(crate) custom_head: Option<String>,
pub(crate) custom_index: Option<String>,
pub(crate) root_name: String,
pub(crate) background_color: Option<(u8, u8, u8, u8)>,
}
type DropHandler = Box<dyn Fn(&Window, FileDropEvent) -> bool>;
@@ -50,6 +51,7 @@ impl Config {
custom_head: None,
custom_index: None,
root_name: "main".to_string(),
background_color: None,
}
}
@@ -137,6 +139,14 @@ impl Config {
self.root_name = name.into();
self
}
/// Sets the background color of the WebView.
/// This will be set before the HTML is rendered and can be used to prevent flashing when the page loads.
/// Accepts a color in RGBA format
pub fn with_background_color(mut self, color: (u8, u8, u8, u8)) -> Self {
self.background_color = Some(color);
self
}
}
impl Default for Config {
+4
View File
@@ -64,6 +64,10 @@ pub fn build(
webview = webview.with_browser_accelerator_keys(false);
}
if let Some(color) = cfg.background_color {
webview = webview.with_background_color(color);
}
// These are commented out because wry is currently broken in wry
// let mut web_context = WebContext::new(cfg.data_dir.clone());
// .with_web_context(&mut web_context);