pub struct PaintProjection(pub fn(&Theme, PaintState) -> Theme);Expand description
How a theme re-colours itself for a PaintState: registered in the
theme’s extension registry and consulted by
Theme::for_paint_state.
Absent, which is the default and what every raw-token theme and the IntUI
preset get, means the generic chain: Theme::for_inactive_window when
the window is inactive, then Theme::for_high_contrast when the
high-contrast preference is set. That chain is a fixed transform of the
tokens (desaturate the accent family, then lift the accent, the ring, the
secondary text and the selection until they reach the high-contrast
floors), which is right for a palette that defines no inactive or
high-contrast colours of its own.
A preset whose source palette does define them (a desktop colour
scheme with an inactive colour group, say) registers this to paint those
colours instead. The function receives the active theme and the whole
state at once, so it decides how the two flags combine; it replaces the
generic chain entirely, and calling Theme::for_inactive_window or
Theme::for_high_contrast from it is how it keeps a part of that chain.
Only colours should change: the paint walker swaps the result in without a
relayout, so geometry a hook changes is not honoured.
It lives in the extension registry for the reason DensityProjection
does: it is optional, typed, non-serializable state only some themes carry.
Tuple Fields§
§0: fn(&Theme, PaintState) -> Theme