summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-06-12 22:12:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-06-12 22:12:15 +0200
commit4c0286e8acdf0792a9680f6f8212a534a51e3da0 (patch)
tree6d478a1074a33b1ab66d5758530bac548106ef94 /src/application.rs
parent2a516dfc4823feb16054e8d484637014e4eedcce (diff)
downloadiced-4c0286e8acdf0792a9680f6f8212a534a51e3da0.tar.gz
iced-4c0286e8acdf0792a9680f6f8212a534a51e3da0.tar.bz2
iced-4c0286e8acdf0792a9680f6f8212a534a51e3da0.zip
Add `background_color` to `Application` and `Sandbox`
Diffstat (limited to 'src/application.rs')
-rw-r--r--src/application.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/application.rs b/src/application.rs
index 19cab7da..2de67eb0 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -1,4 +1,6 @@
-use crate::{window, Command, Element, Executor, Settings, Subscription};
+use crate::{
+ window, Color, Command, Element, Executor, Settings, Subscription,
+};
/// An interactive cross-platform application.
///
@@ -174,6 +176,16 @@ pub trait Application: Sized {
window::Mode::Windowed
}
+ /// Returns the background color of the [`Application`].
+ ///
+ /// By default, it returns [`Color::WHITE`].
+ ///
+ /// [`Application`]: trait.Application.html
+ /// [`Color::WHITE`]: struct.Color.html#const.WHITE
+ fn background_color(&self) -> Color {
+ Color::WHITE
+ }
+
/// Runs the [`Application`].
///
/// On native platforms, this method will take control of the current thread
@@ -256,6 +268,10 @@ where
fn subscription(&self) -> Subscription<Self::Message> {
self.0.subscription()
}
+
+ fn background_color(&self) -> Color {
+ self.0.background_color()
+ }
}
#[cfg(target_arch = "wasm32")]