#[non_exhaustive]pub struct Tokens {Show 16 fields
pub surface: Surface,
pub text: Text,
pub text_role: TextRoles,
pub border: Border,
pub accent: Accent,
pub status: Status,
pub focus_ring: Color32,
pub selection: Color32,
pub radius: Radius,
pub space: Space,
pub size: Size,
pub font: Font,
pub shadow: ShadowTokens,
pub palette: DataPalette,
pub motion_duration: f32,
pub motion: MotionTokens,
/* private fields */
}Expand description
The system tokens of a resolved theme, typed for egui. Custom widgets
read it with Tokens::of instead of hard-coding a colour or a size;
a component’s look is in its kit (Kit::of(ctx).<component>), and any
other token in Tokens::resolved.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.surface: Surface§text: Text§text_role: TextRolesText by role (text-role.*).
border: Border§accent: Accent§status: Status§focus_ring: Color32§selection: Color32§radius: Radius§space: Space§size: Size§font: Font§shadow: ShadowTokens§palette: DataPaletteColours for charts and data views (palette.*).
motion_duration: f32motion.duration in seconds; zero when motion is reduced.
motion: MotionTokensThe other times of motion.
Implementations§
Source§impl Tokens
impl Tokens
Sourcepub fn new(resolved: ResolvedTokens) -> Tokens
pub fn new(resolved: ResolvedTokens) -> Tokens
Types a resolved theme. Resolution guarantees every contract token, so nothing here can be missing.
Sourcepub fn resolved(&self) -> &ResolvedTokens
pub fn resolved(&self) -> &ResolvedTokens
The full resolved set: every tier, descriptions, aliases, problems.
Sourcepub fn color(&self, path: &str) -> Option<Color32>
pub fn color(&self, path: &str) -> Option<Color32>
Any colour token by path, the reference tier included.
Sourcepub fn of(ctx: &Context) -> Arc<Tokens>
pub fn of(ctx: &Context) -> Arc<Tokens>
The tokens of the theme drawn now: of egui’s theme of the moment
(ctx.theme(), the user’s or the system’s light or dark mode)
when a pair is installed, else of the theme installed; the
built-in pop-dark ones (installed on first use) when no theme
was. Read it while drawing, never keep it across frames: a switch
between light and dark changes it without any install.
Inside a ScopedTheme’s show, they are the scoped theme’s.
Sourcepub fn of_theme(ctx: &Context, theme: Theme) -> Arc<Tokens>
pub fn of_theme(ctx: &Context, theme: Theme) -> Arc<Tokens>
The tokens installed for one of egui’s themes (the same for both when the theme installed is alone).
Sourcepub fn egui_theme(&self) -> Theme
pub fn egui_theme(&self) -> Theme
The egui theme this set is drawn under.
Trait Implementations§
impl StructuralPartialEq for Tokens
Auto Trait Implementations§
impl Freeze for Tokens
impl RefUnwindSafe for Tokens
impl Send for Tokens
impl Sync for Tokens
impl Unpin for Tokens
impl UnsafeUnpin for Tokens
impl UnwindSafe for Tokens
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.