Add ThemeChanged variant to Event in iced_sentinel

This commit is contained in:
Héctor Ramón Jiménez 2024-02-27 15:19:26 +01:00
parent 7f7c5ea337
commit c856d2b513
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
13 changed files with 69 additions and 4 deletions

View file

@ -1,5 +1,6 @@
//! Change the appearance of an application.
use iced_core::Color;
use crate::core::Color;
use crate::theme;
/// A set of rules that dictate the style of an application.
pub trait StyleSheet {
@ -10,6 +11,17 @@ pub trait StyleSheet {
///
/// [`Style`]: Self::Style
fn appearance(&self, style: &Self::Style) -> Appearance;
/// Returns the [`theme::Palette`] of the application, if any.
///
/// This may be used by other parts of the `iced` runtime to
/// try to match the style of your application.
///
/// For instance, the Iced Axe uses this [`theme::Palette`] to
/// automatically style itself using your application's colors.
fn palette(&self) -> Option<theme::Palette> {
None
}
}
/// The appearance of an application.

View file

@ -7,11 +7,12 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![forbid(unsafe_code)]
#![deny(
unused_results,
missing_docs,
unused_results,
rust_2018_idioms,
rustdoc::broken_intra_doc_links
)]
pub use iced_core as core;

View file

@ -8,6 +8,7 @@ use palette::{FromColor, Hsl, Mix};
/// A color palette.
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Palette {
/// The background [`Color`] of the [`Palette`].
pub background: Color,