FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ThemeVariant

    struct · ferroui-base · v0.5.0

    struct ThemeVariant
    

    Specifies a UI theme variant that should be used for the control and application types.

    Theme variants are compared by their key.

    View source

    Members

    new

    fn new(key: impl Into<ResourceKey>, inherit_variant: Option<ThemeVariant>) -> Self
    

    Creates a theme variant.

    key is the key of the custom theme variant. inherit_variant is the variant that this variant inherits from: if set, a resource that is missing from the theme dictionary of the current variant is looked up in the dictionary of the inherited one. Inheriting the default variant is not supported.

    Source

    default

    fn default() -> ThemeVariant
    

    Use the default theme variant: inherit the variant from the parent, and at the root use the variant of the platform.

    Source

    light

    fn light() -> ThemeVariant
    

    Use the Light theme variant.

    Source

    dark

    fn dark() -> ThemeVariant
    

    Use the Dark theme variant.

    Source

    actual_theme_variant_property

    fn actual_theme_variant_property() -> &'static StyledProperty<Option<ThemeVariant>>
    

    Defines the ActualThemeVariant property: the theme variant in effect for an element, inherited down the tree. It is None until a root or an element with a requested variant sets it.

    Source

    requested_theme_variant_property

    fn requested_theme_variant_property() -> &'static StyledProperty<Option<ThemeVariant>>
    

    Defines the RequestedThemeVariant property: the theme variant requested for an element and its descendants.

    Source

    key

    fn key(self: &Self) -> &ResourceKey
    

    Key of the theme variant by which variants are compared.

    Source

    inherit_variant

    fn inherit_variant(self: &Self) -> Option<ThemeVariant>
    

    The theme variant that this variant inherits from.

    Source

    update_actual_theme_variant

    fn update_actual_theme_variant(target: &FerroObject)
    

    Updates the actual theme variant of target from its requested theme variant: a requested variant other than the default becomes the actual one, otherwise the actual variant is inherited.

    Source

    register_theme_variant_root_type

    fn register_theme_variant_root_type(type_: &'static TypeInfo)
    

    Declares that the objects of a class that is not a styled element (the application class) are roots of theme variant resolution. Styled elements say so through the is_theme_variant_root virtual. (Upstream: the IThemeVariantRoot interface.)

    Source

    to_platform_theme_variant

    fn to_platform_theme_variant(theme_variant: Option<&ThemeVariant>) -> Option<PlatformThemeVariant>
    

    The platform theme variant of a theme variant (the original's explicit conversion to a nullable platform theme variant): the light and the dark variant convert to their counterparts, another variant converts as the variant it inherits from, and a variant that inherits from neither, or no variant, converts to nothing.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.