Skip to main content

Role

Enum Role 

Source
pub enum Role {
Show 84 variants ShapeFill, ShapeStroke, ShapeTitle, LockedShapeFill, LockedShapeTitle, ShapeType, LockedShapeType, LockedHintIcon, AccentDefault, Accent0, Accent1, Accent2, Accent3, Accent4, Accent5, Accent6, Accent7, TextBoxFill, TextBoxStroke, AreaStroke, RouteNormal, RouteSelected, RouteHighlighted, RouteInProgress, RouteProposedEndpoint, PinStem, PinText, PinTag, PinStemSelected, PinTagSelected, PinLabelPlaceholder, DragPreviewStroke, DragActiveFill, DragActiveStroke, EdgeDragPreview, MoveRefusedStroke, StandingConflict, SelectionFrame, SelectionFrameOutline, ControlHandleFill, ControlHandleStroke, WaypointFill, ResizeCornerFill, ResizeCornerStroke, ResizeCornerActiveFill, ResizeCornerActiveStroke, ImageDragBox, MarqueeFill, NewBlockPreviewStroke, NewPinPreviewFill, NewPinPreviewStroke, RouteStartTarget, CanvasBackground, GridLine, PinDragIndicator, DebugMark, AlignmentGuide, SizeReadout, LiveDot, DotWriting, DotReadOnly, DotScratch, ViewingTint, ViewingInk, ViewingReturnInk, Toast, ToastText, TagBadge, TagBadgeText, AuthorAvatar0, AuthorAvatar1, AuthorAvatar2, AuthorAvatar3, AuthorAvatar4, AuthorAvatarText, TitleBlockBorder, ChangeRing, EditorText, EditorFill, EditorCaret, EditorSelection, EditorHint, EditorBorder, Transparent,
}
Expand description

A semantic color slot. Drawing code passes a Role to every draw call; the renderer resolves it through the active Theme (role → Base → color), so call sites name intent, never a literal color. Add a variant here for each semantically-distinct color in the app.

Transparent must remain the last variant: N_ROLES is derived from it.

Variants§

§

ShapeFill

§

ShapeStroke

§

ShapeTitle

§

LockedShapeFill

§

LockedShapeTitle

§

ShapeType

§

LockedShapeType

§

LockedHintIcon

§

AccentDefault

§

Accent0

§

Accent1

§

Accent2

§

Accent3

§

Accent4

§

Accent5

§

Accent6

§

Accent7

§

TextBoxFill

§

TextBoxStroke

§

AreaStroke

§

RouteNormal

§

RouteSelected

§

RouteHighlighted

§

RouteInProgress

§

RouteProposedEndpoint

§

PinStem

§

PinText

§

PinTag

§

PinStemSelected

§

PinTagSelected

§

PinLabelPlaceholder

Faint “Add Name”/“Add Type” placeholder shown at an empty pin label slot while the pin’s shape is selected.

§

DragPreviewStroke

§

DragActiveFill

§

DragActiveStroke

§

EdgeDragPreview

§

MoveRefusedStroke

A move the destination refuses, so the drag is showing what will not be taken. The same base the read-only dot is drawn in: it already means “no” here.

§

StandingConflict

A conflict the document already holds — two routing shapes sharing cells, which a paste can create and nothing refuses. Amber, not red: it is a fault to clear, not a gesture being turned away.

§

SelectionFrame

§

SelectionFrameOutline

§

ControlHandleFill

§

ControlHandleStroke

§

WaypointFill

§

ResizeCornerFill

§

ResizeCornerStroke

§

ResizeCornerActiveFill

§

ResizeCornerActiveStroke

§

ImageDragBox

§

MarqueeFill

§

NewBlockPreviewStroke

§

NewPinPreviewFill

§

NewPinPreviewStroke

§

RouteStartTarget

The grow-out target shown on a pin/anchor when hovering it in the select tool (to start a route) or nearing it while routing (to end one).

§

CanvasBackground

§

GridLine

§

PinDragIndicator

§

DebugMark

§

AlignmentGuide

Thin line shown while dragging when an edge/center/pin-stub lines up with another shape’s. A base color, not an accent.

§

SizeReadout

The grid-cell size readout shown inside a block’s upper-left corner while it is being resized. A base color, like the other transient drag hints.

§

LiveDot

The liveness dot at the head of the top bar, in its four states: recorded, a write in flight, nothing writable, and a scratch session with no file behind it. Hues rather than base tones — they say which state, not how loud — except the scratch one, which is a base tone on purpose: it is the absence of a state, not one of them.

§

DotWriting

§

DotReadOnly

§

DotScratch

§

ViewingTint

The top bar while the time machine is open: the amber wash over the bar’s own glass, the ink the centre’s words and the dot take, and the word on the one filled control in the shell. The wash carries its own alpha, because it goes over the fill the bar already has — the bar changes state rather than becoming another object.

§

ViewingInk

§

ViewingReturnInk

§

Toast

The toast that says what a file operation did: the slab and the words on it. The mockup’s is a dark glass plate with white text, which is one scheme’s answer to a question the palette answers for both — so it takes the inverse-video pairing Role::TagBadge argues for, like every other thing in this app that has to be read over whatever is behind it.

§

ToastText

§

TagBadge

A named rev’s badge in the history list: the chip behind the tag, and the text on it. Inverse video off the base ramp — the foreground slot filled, the background slot written on it — which is the only pairing that clears WCAG AA in every scheme this app ships, light and dark. A badge whose text you cannot read is not a badge.

§

TagBadgeText

§

AuthorAvatar0

The initials disc beside a history row. One of five accent slots, picked by hashing the author’s name, so the same hand keeps the same colour down the list without anybody assigning one.

Roles rather than arithmetic on the palette: the avatar wants categorical colour, which is what the accent ramp is for, and naming the five means a scheme can re-point them.

§

AuthorAvatar1

§

AuthorAvatar2

§

AuthorAvatar3

§

AuthorAvatar4

§

AuthorAvatarText

The initials themselves, read over any of the five.

§

TitleBlockBorder

The outline around a title block, in both homes it has: the editor’s corner of the canvas and the printed sheet’s footer. Sheet furniture, not a document object — which is why it does not borrow Role::AreaStroke, whose color a user edits to restyle their own boundary areas.

§

ChangeRing

The ring a document step leaves round what it changed. A guide role, so a base tone — it points at the drawing for a moment, like Role::AlignmentGuide and Role::SizeReadout beside it, and is not content with an accent of its own.

§

EditorText

The in-place editor where it replaces no label of its own colour: its ink and its field. An editor inside a block body takes the label’s roles instead.

§

EditorFill

§

EditorCaret

The caret and the selection highlight, every editor’s.

§

EditorSelection

§

EditorHint

The placeholder’s ink while the draft is empty.

§

EditorBorder

The ring round every editor’s field, so it reads as a field standing over the drawing rather than as more of the drawing.

§

Transparent

Resolves to a fully transparent color (transparent fills, no-op strokes). Keep this the last variant — N_ROLES depends on it.

Trait Implementations§

Source§

impl Clone for Role

Source§

fn clone(&self) -> Role

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Role

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Role

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for Role

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for Role

Source§

impl PartialEq for Role

Source§

fn eq(&self, other: &Role) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Role

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Role

Source§

impl Eq for Role

Source§

impl StructuralPartialEq for Role

Auto Trait Implementations§

§

impl Freeze for Role

§

impl RefUnwindSafe for Role

§

impl Send for Role

§

impl Sync for Role

§

impl Unpin for Role

§

impl UnsafeUnpin for Role

§

impl UnwindSafe for Role

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,