Struct PresencePalette
pub struct PresencePalette {
pub lightness: f32,
pub chroma: f32,
pub colors: [AlphaColor<Srgb>; 12],
}Expand description
One colour per participant: PRESENCE_HUES at one OKLCH lightness and
chroma, so they differ in hue only and no participant looks more
important than another. Where sRGB cannot carry the full chroma at a hue
(a light cyan) only that hue’s chroma drops; lightness never does.
Fields§
§lightness: f32§chroma: f32§colors: [AlphaColor<Srgb>; 12]Implementations§
§impl PresencePalette
impl PresencePalette
pub fn new(lightness: f32, chroma: f32) -> PresencePalette
pub fn get(&self, slot: usize) -> AlphaColor<Srgb>
pub fn get(&self, slot: usize) -> AlphaColor<Srgb>
Slot slot, wrapping past PRESENCE_LEN.
pub fn series(&self, index: usize) -> AlphaColor<Srgb>
pub fn series(&self, index: usize) -> AlphaColor<Srgb>
The indexth colour of a data series (chart categories, tag
colours): the same twelve hues, walked so the first six are at least
60° apart from each other (consecutive ones mostly 120°–180°), the
next six fill the gaps, and the walk wraps past PRESENCE_LEN.
Equal lightness and chroma keep every series equally loud.
pub fn hue(&self, hue: PresenceHue) -> AlphaColor<Srgb>
pub fn hue(&self, hue: PresenceHue) -> AlphaColor<Srgb>
A person’s colour as this palette paints it.
pub fn of(&self, identity: AlphaColor<Srgb>) -> AlphaColor<Srgb>
pub fn of(&self, identity: AlphaColor<Srgb>) -> AlphaColor<Srgb>
An identity colour (a roster choice, a hashed id, an avatar colour)
as this palette paints it: its hue at the palette’s lightness and
chroma. Identities travel between devices and themes as colours;
painting them through here keeps every participant equal on every
ground. A grey identity has no hue and stays grey at the palette’s
lightness: it is someone whose colour is not known yet
(ui::presence::UNSETTLED_RGB), and a hue picked for them would be
a colour they then change from.
pub fn ring_on(
&self,
identity: AlphaColor<Srgb>,
ground: AlphaColor<Srgb>,
) -> AlphaColor<Srgb>
pub fn ring_on( &self, identity: AlphaColor<Srgb>, ground: AlphaColor<Srgb>, ) -> AlphaColor<Srgb>
A person’s colour as the ring of their face on ground (identity
as Self::of takes it): their palette colour, moved in lightness
away from the ground, hue and chroma kept, only where it would not
otherwise stand out from it as a mark (NON_TEXT_MIN_CONTRAST).
The palette is tuned for windows and floating surfaces; a face on the
desktop’s ground (the top bar) keeps its ring legible there too.
pub fn idle_on(
&self,
identity: AlphaColor<Srgb>,
ground: AlphaColor<Srgb>,
) -> AlphaColor<Srgb>
pub fn idle_on( &self, identity: AlphaColor<Srgb>, ground: AlphaColor<Srgb>, ) -> AlphaColor<Srgb>
A person’s colour while they are idle or away (identity as
Self::of takes it), on ground: their hue kept, most of its
chroma let go (IDLE_CHROMA), and moved toward the ground
(IDLE_FADE of the way at most) only as far as it stays a mark
against it (NON_TEXT_MIN_CONTRAST). A face dims without ever
vanishing into the bar it sits on, whatever the hue and theme; where
even the quieted colour would miss the floor, it moves away from the
ground until it holds.
Trait Implementations§
§impl Clone for PresencePalette
impl Clone for PresencePalette
§fn clone(&self) -> PresencePalette
fn clone(&self) -> PresencePalette
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PresencePalette
impl Debug for PresencePalette
§impl PartialEq for PresencePalette
impl PartialEq for PresencePalette
impl Copy for PresencePalette
impl StructuralPartialEq for PresencePalette
Auto Trait Implementations§
impl Freeze for PresencePalette
impl RefUnwindSafe for PresencePalette
impl Send for PresencePalette
impl Sync for PresencePalette
impl Unpin for PresencePalette
impl UnsafeUnpin for PresencePalette
impl UnwindSafe for PresencePalette
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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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