Struct nixterm::term::TermWriter[][src]

pub struct TermWriter<'a, O> where
    O: Write + AsRawFd + 'a, 
{ /* fields omitted */ }

Methods

impl<'a, O> TermWriter<'a, O> where
    O: Write + AsRawFd + 'a, 
[src]

Set the terminal's foreground color.

T a ansi::Color enum, a number (u8) or a string. strings may name a color, or provide custom r, g, and b values. Any of the following are valid:

  • "black"
  • "red"
  • "green"
  • "yellow"
  • "blue"
  • "magenta"
  • "cyan"
  • "grey"
  • "white" (same as "bright grey")
  • "bright*" (* may be any of the other named colors)
  • "#rrggbb"
  • "#rgb"
  • "rgb(r, g, b)"

Numbers are also valid, the number must fit inside a u8 (so it should be in the range 0-255).

Compatibility

Everything layed out above will work as far as this library, but the chances of it actually being supported across any meaningful number of terminals is closed to 0.

24-bit Colors

Full RGB (that is, 24-bit color) terminals are pretty rare. When full 24-bit colors are not supported, the color will get as close as it can with whatever the terminal provides.

8-bit Colors

256 color terminals are fairly common, using depending on indices beyond 15 is still risky though.

4/3-bit Colors

Basically all terminals will support 3-bits, many will support 4 (that 4th bit gives the option of a "bright" variant).

Trait Implementations

impl<'a, O> Write for TermWriter<'a, O> where
    O: Write + AsRawFd
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

Auto Trait Implementations

impl<'a, O> !Send for TermWriter<'a, O>

impl<'a, O> Sync for TermWriter<'a, O> where
    O: Sync