pub struct GradientDisplay<'a, I> { /* private fields */ }
Expand description
A gradient string representation.
Implementations§
Source§impl<'a, I> GradientDisplay<'a, I>
impl<'a, I> GradientDisplay<'a, I>
Sourcepub const fn background(self) -> Self
pub const fn background(self) -> Self
Colorize background.
Default is foreground.
Examples found in repository?
examples/list.rs (line 50)
14fn main() {
15 let logo = LOGO
16 .lines()
17 .map(|l| format!("\t\t{}", l))
18 .collect::<Vec<_>>()
19 .join("\n");
20 let raibow = [
21 RGB::new(255, 0, 0),
22 RGB::new(0, 255, 0),
23 RGB::new(0, 0, 255),
24 ];
25
26 println!("{}", logo.gradient(raibow));
27
28 println!();
29
30 let gradients = [
31 Gradient::Atlast,
32 Gradient::Cristal,
33 Gradient::Fruit,
34 Gradient::Instagram,
35 Gradient::Mind,
36 Gradient::Morning,
37 Gradient::Passion,
38 Gradient::Pastel,
39 Gradient::Rainbow,
40 Gradient::Retro,
41 Gradient::Summer,
42 Gradient::Teen,
43 Gradient::Vice,
44 Gradient::Monsoon,
45 Gradient::Forest,
46 ];
47
48 gradients.into_iter().for_each(|gradient| {
49 let short = " ".repeat(10);
50 let short = short.gradient(gradient).background();
51 let long = " ".repeat(100);
52 let long = long.gradient(gradient).background();
53 let name = format!("{:?}", gradient);
54 println!(" {:<15} {} {}", name, short, long);
55 });
56}
Sourcepub const fn foreground(self) -> Self
pub const fn foreground(self) -> Self
Colorize foreground.
It’s a default option.
Trait Implementations§
Source§impl<'a, I: Clone> Clone for GradientDisplay<'a, I>
impl<'a, I: Clone> Clone for GradientDisplay<'a, I>
Source§fn clone(&self) -> GradientDisplay<'a, I>
fn clone(&self) -> GradientDisplay<'a, I>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a, I: Debug> Debug for GradientDisplay<'a, I>
impl<'a, I: Debug> Debug for GradientDisplay<'a, I>
Source§impl<I> Display for GradientDisplay<'_, I>
impl<I> Display for GradientDisplay<'_, I>
Source§impl<'a, I: Ord> Ord for GradientDisplay<'a, I>
impl<'a, I: Ord> Ord for GradientDisplay<'a, I>
Source§fn cmp(&self, other: &GradientDisplay<'a, I>) -> Ordering
fn cmp(&self, other: &GradientDisplay<'a, I>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a, I: PartialEq> PartialEq for GradientDisplay<'a, I>
impl<'a, I: PartialEq> PartialEq for GradientDisplay<'a, I>
Source§impl<'a, I: PartialOrd> PartialOrd for GradientDisplay<'a, I>
impl<'a, I: PartialOrd> PartialOrd for GradientDisplay<'a, I>
impl<'a, I: Eq> Eq for GradientDisplay<'a, I>
impl<'a, I> StructuralPartialEq for GradientDisplay<'a, I>
Auto Trait Implementations§
impl<'a, I> Freeze for GradientDisplay<'a, I>where
I: Freeze,
impl<'a, I> RefUnwindSafe for GradientDisplay<'a, I>where
I: RefUnwindSafe,
impl<'a, I> Send for GradientDisplay<'a, I>where
I: Send,
impl<'a, I> Sync for GradientDisplay<'a, I>where
I: Sync,
impl<'a, I> Unpin for GradientDisplay<'a, I>where
I: Unpin,
impl<'a, I> UnwindSafe for GradientDisplay<'a, I>where
I: UnwindSafe,
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