Struct leechbar::Foreground
[−]
[src]
pub struct Foreground { /* fields omitted */ }
Foreground of a component.
The foreground of a component. This is used for setting the text, the text alignment and the vertical text offset.
Examples
use leechbar::{Foreground, Text, BarBuilder, Alignment}; let bar = BarBuilder::new().spawn().unwrap(); let text = Text::new(&bar, "Hello, World", None, None).unwrap(); let fg = Foreground::new() .text(text) .yoffset(3) .alignment(Alignment::RIGHT);
Methods
impl Foreground
[src]
fn new() -> Self
[src]
fn text(self, text: Text) -> Self
[src]
Set the text of the foreground.
Default: No text.
Examples
use leechbar::{Foreground, Text, BarBuilder}; let bar = BarBuilder::new().spawn().unwrap(); let text = Text::new(&bar, "Text :)", None, None).unwrap(); let fg = Foreground::new().text(text);
fn alignment(self, alignment: Alignment) -> Self
[src]
Set the alignment of the text inside the component.
Default: Alignment::CENTER
Examples
use leechbar::{Foreground, Alignment}; let fg = Foreground::new().alignment(Alignment::RIGHT);
fn yoffset(self, yoffset: i16) -> Self
[src]
Offset the text vertically. Increasing this offset, moves the text down from the center.
Default: Bar's vertical text offset.
use leechbar::Foreground; let fg = Foreground::new().yoffset(-3);
Trait Implementations
impl Clone for Foreground
[src]
fn clone(&self) -> Foreground
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<Text> for Foreground
[src]
fn from(text: Text) -> Foreground
[src]
Performs the conversion.