Skip to content
FutureBlitz

    Install

    Import std.term.style

    TermColor

    std.term.style

    struct

    Public Struct TermColor Implements Hashable, Printable

    A color for text, or for what's behind it: the terminal's NORMAL one, its zero; one of the 16 BASIC ones or 256 INDEXED ones, by its Index; or RGB's R, G, and B. A terminal that shows fewer colors gets the nearest it has, as Nearest gives it.

    std/term/style.fb, line 58

    • Public ReadOnly Field Kind: ColorKind field #

      Whether it's the terminal's own, a basic one, an indexed one, or RGB.

    • Public ReadOnly Field Index: UInt8 field #

      A BASIC or INDEXED color's index.

    • Public ReadOnly Field R: UInt8 field #

      An RGB color's red.

    • Public ReadOnly Field G: UInt8 field #

      An RGB color's green.

    • Public ReadOnly Field B: UInt8 field #

      An RGB color's blue.

    • Public Static Property Normal: TermColor property #

      The terminal's own color, for text or what's behind it.

    • Public Static Property Black: TermColor property #

      Black, a basic color.

    • Public Static Property Red: TermColor property #

      Red, a basic color.

    • Public Static Property Green: TermColor property #

      Green, a basic color.

    • Public Static Property Yellow: TermColor property #

      Yellow, a basic color.

    • Public Static Property Blue: TermColor property #

      Blue, a basic color.

    • Public Static Property Magenta: TermColor property #

      Magenta, a basic color.

    • Public Static Property Cyan: TermColor property #

      Cyan, a basic color.

    • Public Static Property White: TermColor property #

      White, a basic color.

    • Public Static Property BrightBlack: TermColor property #

      Bright black, which most terminals show as gray.

    • Public Static Property BrightRed: TermColor property #

      Bright red, a basic color.

    • Public Static Property BrightGreen: TermColor property #

      Bright green, a basic color.

    • Public Static Property BrightYellow: TermColor property #

      Bright yellow, a basic color.

    • Public Static Property BrightBlue: TermColor property #

      Bright blue, a basic color.

    • Public Static Property BrightMagenta: TermColor property #

      Bright magenta, a basic color.

    • Public Static Property BrightCyan: TermColor property #

      Bright cyan, a basic color.

    • Public Static Property BrightWhite: TermColor property #

      Bright white, a basic color.

    • @PanicsAtCaller Public Static Method Basic(index: Int): TermColor static method #

      One of the 16 basic colors by its number: black, red, green, yellow, blue, magenta, cyan, and white from 0 to 7, and their bright ones from 8 to 15. Panics past 15.

    • Public Static Method Indexed(index: UInt8): TermColor static method #

      One of 256 colors by its number: the 16 basic ones, then a cube of 6 reds by 6 greens by 6 blues from 16 to 231, and 24 grays, darkest first, from 232 to 255.

    • Public Static Method Rgb(r: UInt8, g: UInt8, b: UInt8): TermColor static method #

      Red, green, and blue, from 0 to 255 each.

    • @PanicsAtCaller Public Static Method Hex(text: String): TermColor static method #

      The color hex text gives, as CSS writes one: "#rgb" or "#rrggbb", with or without the "#", in either case. Any other text panics; TryHex takes text from outside the program.

    • Public Static Method TryHex(text: String): TermColor? static method #

      The color hex text gives, as Hex takes it, or Null for text that isn't one.

    • Public Method ToRgb(): (Int, Int, Int) method #

      Its red, green, and blue: an RGB color's own, and for another, what xterm shows it as. The terminal's NORMAL color has none of its own, so it's black's.

    • Public Method Nearest(level: ColorLevel): TermColor method #

      The color as a terminal that shows level's colors shows it: itself, where it has it, or the nearest one it has, by red, green, and blue. NONE has none, so it's NORMAL there.

    • Public Method ToString(): String method #

      "normal", "red", "bright red", "color 208", or "#ff8800".

    Report an issue with this page or with FutureBlitz on GitHub.