pub struct BackgroundColorMsg(pub Color);Expand description
BackgroundColorMsg represents a background color message. This message is
emitted when the program requests the terminal background color with the
request_background_color command.
This is commonly used in Model::init to get the terminal background color
for style definitions. For that you’ll want to call is_dark() to determine
if the color is dark or light. For example:
ⓘ
fn init(&self) -> Cmd { request_background_color() }
fn update(&mut self, msg: Box<dyn Msg>) -> Cmd {
if let Some(bg) = msg.as_any().downcast_ref::<BackgroundColorMsg>() {
self.styles = new_styles(bg.is_dark());
}
None
}Tuple Fields§
§0: ColorImplementations§
Trait Implementations§
Source§impl Clone for BackgroundColorMsg
impl Clone for BackgroundColorMsg
Source§fn clone(&self) -> BackgroundColorMsg
fn clone(&self) -> BackgroundColorMsg
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BackgroundColorMsg
Source§impl Debug for BackgroundColorMsg
impl Debug for BackgroundColorMsg
impl Eq for BackgroundColorMsg
Source§impl PartialEq for BackgroundColorMsg
impl PartialEq for BackgroundColorMsg
impl StructuralPartialEq for BackgroundColorMsg
Auto Trait Implementations§
impl Freeze for BackgroundColorMsg
impl RefUnwindSafe for BackgroundColorMsg
impl Send for BackgroundColorMsg
impl Sync for BackgroundColorMsg
impl Unpin for BackgroundColorMsg
impl UnsafeUnpin for BackgroundColorMsg
impl UnwindSafe for BackgroundColorMsg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more