pub struct StyleManager {
pub scheme: ColorScheme,
pub system_dark: bool,
pub effective_dark: bool,
}Expand description
Color-scheme arbiter mirroring AdwStyleManager. Combines the app’s
stated intent (scheme) with the last-seen OS preference
(system_dark) to produce a single boolean (effective_dark) used
by the rest of the pipeline.
- Populated by the window backend from
winit::Theme(resumedandWindowEvent::ThemeChanged). - On Linux, an XDG desktop-portal
org.freedesktop.portal.Settingssubscription pushesset_system_darkupdates as the desktop’s color-scheme preference changes (best-effort; falls back to winit when the portal is unavailable). crate::signals::style_manager_to_signal(W1.6) mirrorseffective_darkintoSignals["__theme__"]as"dark"/"light".crate::signals::apply_theme_signal_to_root_classesthen writestheme-dark/theme-lightonto the root entity’sLumenClasses.
Fields§
§scheme: ColorSchemeApplication-side intent. Default = follow OS.
system_dark: boolLast-seen OS preference. Defaults to false (light) until the
backend or portal listener writes through.
effective_dark: boolComputed result of scheme + system_dark. Read by every theme
consumer; written by Self::recompute from inside the setters.
Implementations§
Source§impl StyleManager
impl StyleManager
Sourcepub fn with_scheme(scheme: ColorScheme) -> Self
pub fn with_scheme(scheme: ColorScheme) -> Self
Construct with a stated intent, recomputed against a fresh (light) system default. Useful at backend startup before any OS hint has arrived.
Sourcepub fn set_scheme(&mut self, scheme: ColorScheme)
pub fn set_scheme(&mut self, scheme: ColorScheme)
Update the app’s intent and recompute Self::effective_dark.
Sourcepub fn set_system_dark(&mut self, system_dark: bool)
pub fn set_system_dark(&mut self, system_dark: bool)
Update the last-seen OS preference and recompute
Self::effective_dark.
Trait Implementations§
Source§impl Clone for StyleManager
impl Clone for StyleManager
Source§fn clone(&self) -> StyleManager
fn clone(&self) -> StyleManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for StyleManager
impl Component for StyleManager
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for StyleManager
impl Debug for StyleManager
Source§impl Default for StyleManager
impl Default for StyleManager
Source§impl PartialEq for StyleManager
impl PartialEq for StyleManager
Source§fn eq(&self, other: &StyleManager) -> bool
fn eq(&self, other: &StyleManager) -> bool
self and other values to be equal, and is used by ==.impl Copy for StyleManager
impl Eq for StyleManager
impl Resource for StyleManager
impl StructuralPartialEq for StyleManager
Auto Trait Implementations§
impl Freeze for StyleManager
impl RefUnwindSafe for StyleManager
impl Send for StyleManager
impl Sync for StyleManager
impl Unpin for StyleManager
impl UnsafeUnpin for StyleManager
impl UnwindSafe for StyleManager
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
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DynEq for T
impl<T> DynEq for T
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FromTemplate for T
impl<T> FromTemplate for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<T> Template for T
impl<T> Template for T
§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.