pub struct OmaColorFormat {
pub theme: Option<Theme>,
/* private fields */
}Expand description
OmaColorFormat
OmaColorFormat is a structure that defines the color format and theme settings for oma.
Fields§
§theme: Option<Theme>An optional Theme object that defined by oma.
Implementations§
Source§impl OmaColorFormat
impl OmaColorFormat
Sourcepub fn new(follow: bool, duration: Duration) -> Self
pub fn new(follow: bool, duration: Duration) -> Self
Examples found in repository?
examples/pager.rs (line 33)
32fn main() -> io::Result<()> {
33 let cf = OmaColorFormat::new(true, Duration::from_millis(100));
34 let pager = OmaPager::new(Some("QAQ".to_string()), &cf, Box::new(OmaPagerUIText));
35 let mut p = Pager::External(Box::new(pager));
36 let mut w = p.get_writer()?;
37 w.write_all("QAQ\n".cyan().to_string().as_bytes()).ok();
38 w.write_all(b"PAP").ok();
39
40 drop(w);
41 p.wait_for_exit()?;
42
43 Ok(())
44}Sourcepub fn color_str<D>(&self, input: D, color: Action) -> StyledObject<D>
pub fn color_str<D>(&self, input: D, color: Action) -> StyledObject<D>
Convert input into StyledObject
This function applies a color scheme to the given input string based on the specified action and the current terminal color schemes.
§Arguments
input- The input data to be themed.color- AnActionenum value that specifies the color to be applied.
§Returns
Returns a StyledObject that contains the styled input data.
Auto Trait Implementations§
impl Freeze for OmaColorFormat
impl RefUnwindSafe for OmaColorFormat
impl Send for OmaColorFormat
impl Sync for OmaColorFormat
impl Unpin for OmaColorFormat
impl UnwindSafe for OmaColorFormat
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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