pub struct ColorRamp {
pub head: Color,
pub bright: Color,
pub mid: Color,
pub dim: Color,
pub fade: Color,
}Expand description
Five-stop color ramp. head is the brightest cell (typically white);
stops degrade through bright, mid, dim, to the visible-but-faint
fade at the tail.
The renderer maps cell positions in [0, length-1] to these stops:
- Truecolor: linear lerp between adjacent stops.
- 256-color: nearest of the 5 stops.
- 16-color: collapsed into 3 zones —
bright(early trail),mid(middle),fade(tail) — each mapped to the nearest named color.
§Example
use matrix_rain::{ColorRamp, Theme};
use ratatui::style::Color;
let monochrome = ColorRamp {
head: Color::White,
bright: Color::Gray,
mid: Color::DarkGray,
dim: Color::DarkGray,
fade: Color::Black,
};
let theme = Theme::Custom(monochrome);Fields§
§head: ColorBrightest stop. The head cell uses this when head_white is true.
bright: ColorBright stop just below the head. Also used by the head when
head_white is false.
mid: ColorMiddle of the gradient.
dim: ColorDim stop near the tail.
fade: ColorFaintest visible stop at the very end of the trail.
Trait Implementations§
impl Copy for ColorRamp
impl Eq for ColorRamp
impl StructuralPartialEq for ColorRamp
Auto Trait Implementations§
impl Freeze for ColorRamp
impl RefUnwindSafe for ColorRamp
impl Send for ColorRamp
impl Sync for ColorRamp
impl Unpin for ColorRamp
impl UnsafeUnpin for ColorRamp
impl UnwindSafe for ColorRamp
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
Mutably borrows from an owned value. Read more
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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