#[non_exhaustive]pub enum Depth {
Flat,
Raised,
Well,
Sunken,
Overlay,
}Expand description
How a region sits relative to the surface behind it.
Fill and bevel are named together because naming them apart is what let
them disagree. Every consumer measured had at least one region carrying a
raised bevel over a recessed fill: audiofiles fixed it in raised_frame
and recorded the bug in its doc comment, and Balanced Breakfast still had
twelve of them a year later. A single name for the pair makes that
unrepresentable.
#[non_exhaustive] for the same reason as Fill, and in the same
release: a depth this renderer has no drawing for should cost it a
wildcard arm, not a compile error and a wait on someone else’s publish.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Flat
Level with its surroundings. No edge.
Raised
A card laid on the panel it sits in.
Well
A hole in the panel, with content down inside it. For anything the user looks into: a table body, a tag tree, a text field.
Sunken
Set back from what it sits on, by colour alone. No edge.
The one member carrying a fill without a bevel, so a renderer cannot
assume the two arrive together. That is deliberate and it is still the
pairing rule: both halves come off the same Depth, so they cannot
disagree, and here one half is legitimately absent.
Distinct from Depth::Flat, which has no fill either and inherits.
Recessed and level-with are different claims, and only one of them
needs a colour.
Overlay
A surface sitting over the page rather than in it. A modal, a popover, a menu.
Takes elevation and no bevel: a surface overlaying the page is lifted off it, and a surface in the page is cut into it. That is the same pairing rule the rest of the enum holds, applied to the one case where the separation is not an edge at all — the lift and the scrim behind it are already saying where the surface is.
Every renderer had the surface before it had this variant.
makeover-tui carries Palette::overlay, makeover-immediate gained
Palette::elevation at 0.10.0, and makeover-webview emits
--elevation-overlay. What was missing was the route from a description
to any of them, which is why this is one variant rather than a feature.
Implementations§
Source§impl Depth
impl Depth
Sourcepub const fn fill(self) -> Option<Fill>
pub const fn fill(self) -> Option<Fill>
The surface this depth is filled with.
Depth::Flat has no fill of its own: it inherits whatever it sits on,
which is the difference between level-with and painted-the-same-colour.
Sourcepub const fn pressed(self) -> Self
pub const fn pressed(self) -> Self
Pressing a raised region reads as a well, and nothing else moves.
Depth::Overlay is untouched along with the rest: an overlay is a
surface, not a control, so there is nothing there to press.