pub struct Palette {Show 15 fields
pub page: Color32,
pub raised: Color32,
pub overlay: Color32,
pub well: Color32,
pub sunken: Color32,
pub bevel_light: Color32,
pub bevel_dark: Color32,
pub elevation: Color32,
pub content: Color32,
pub content_muted: Color32,
pub action: Color32,
pub danger: Color32,
pub success: Color32,
pub warning: Color32,
pub info: Color32,
}Expand description
The resolved colours this renderer needs, as flat values.
Built by the app from whatever it already uses to resolve a theme, then held and reused. Deliberately not a trait and not string-keyed: a bevel is painted per widget per frame, and a map lookup per edge is a cost with nothing to show for it.
Fields§
§page: Color32surface-page.
raised: Color32surface-raised.
overlay: Color32surface-overlay.
well: Color32surface-well.
Required, not optional. makeover derives it for every theme from 2.3.0,
so a resolved palette without a well is not a thing that exists here.
It was an Option while that was untrue, and this renderer substituted
the page; makeover-tui keeps its own Option for a different reason,
since a terminal can have the colour and still be unable to show it.
sunken: Color32surface-sunken.
A surface set back from the one it sits on, by colour and nothing else.
Not a well: a well is a hole with an edge, and this has no edge. An
immediate-mode renderer paints an arbitrary rect, so unlike
makeover-tui it has no excuse for declining this one.
Required rather than optional, on the same footing as well: all 31
themes makeover embeds author it.
bevel_light: Color32bevel-light.
bevel_dark: Color32bevel-dark.
elevation: Color32elevation.
What a surface that floats OVER the page is cast onto it with. The one intent here that is about a surface’s relationship to the page rather than about the surface, which is why it is a translucent near-black on every theme rather than something read off the palette’s own ramp.
Only for a surface that overlays. A menu, a tooltip, a modal. A surface in the layout takes a bevel, and reaching for this on a panel or a card is how a pre-Platinum look survives a conversion under a new name.
egui has a real answer for this where a terminal does not: see
Palette::cast, which is the shadow to hand an
egui::Frame.
content: Color32content.
Ordinary text. Added 0.5.0 with the field renderer, which is the first thing here that draws any: until then this crate painted surfaces and edges and let the caller’s own egui visuals answer for text.
content_muted: Color32content-muted.
A field’s hint, and what
makeover_layout::State::Disabled
resolves to. Both readings come from the description rather than from
here: State::Disabled names this intent by token.
action: Color32action-primary.
What a control is drawn in. Added 0.12.0 with the table renderer, for the
reason content was added 0.5.0 with the field renderer: a link in a
cell is the first thing here that needs the action intent, and a palette
should carry what is used.
This is the intent CellPart exists to
separate. A cell holding a control took the cell’s text colour until the
description could say otherwise, which is the drift makeover-layout
0.14.0 named and makeover-webview 0.25.0 fixed on its own side.
danger: Color32danger.
A field’s error message, a destructive control, a bar that has run over.
success: Color32success.
Added 0.18.0 with widget, which is the first thing here that draws a
Tone. The three status intents arrive together and not one at a
time: Tone is five members wide and a resolver missing one has to
invent a colour for it, which is the substitution this crate spent
0.2.0 removing from Palette::fill.
warning: Color32warning.
info: Color32info.
Implementations§
Source§impl Palette
impl Palette
Sourcepub const fn fill(&self, fill: Fill) -> Option<Color32>
pub const fn fill(&self, fill: Fill) -> Option<Color32>
Resolve a surface intent, or None for one this renderer does not know.
A plain lookup. There is still no substitution: the old one existed only
while surface-well was underived, and every consumer reads the real
token now.
Option since 0.3.0, because Fill became #[non_exhaustive] in
makeover-layout 0.4.0 and a total function over an open enum can only
stay total by inventing a colour for a member it has never heard of.
That is the substitution this crate spent 0.2.0 removing, so the return
type moved instead. Every member the description has today is answered
with Some.
Sourcepub const fn tone(&self, tone: Tone) -> Color32
pub const fn tone(&self, tone: Tone) -> Color32
The colour a Tone reads as.
Total, unlike fill, and the difference is not an
inconsistency. Fill is #[non_exhaustive] and Tone is not: the
description layer settled tone at five members and grows surfaces, so a
total function here cannot be made to invent a colour by an upstream
release the way a total fill could.
Tone::Neutral is content rather than a colour of
its own, which is what “an ordinary fact” means: a neutral badge is text
in a box, not a fifth status.
Sourcepub const fn cast(&self) -> Shadow
pub const fn cast(&self) -> Shadow
The cast shadow for a surface that overlays the page.
What “overlaying” means in immediate mode, answered rather than skipped.
egui already paints shadows for its menus and windows through
egui::Frame::shadow, so the honest port is to hand that machinery the
theme’s tone instead of egui’s own default, not to invent a painter here
the way paint_bevel had to.
The geometry matches what makeover-webview composes, in points rather
than pixels: a small downward offset and a wide soft blur. A Platinum-era
menu sits just off the page rather than hovering above it.
egui::Frame::popup(ui.style())
.shadow(palette.cast())
.show(ui, |ui| { ui.label("over the page"); });Trait Implementations§
impl Copy for Palette
impl Eq for Palette
impl StructuralPartialEq for Palette
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnsafeUnpin for Palette
impl UnwindSafe for Palette
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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