# Enum ansi_term::Colour [−] [src]

    pub enum Colour {
        Black,
        Red,
        Green,
        Yellow,
        Blue,
        Purple,
        Cyan,
        White,
        Fixed(u8),
    }

A colour is one specific type of ANSI escape code, and can refer to either the foreground or background colour.

These use the standard numeric sequences. See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html

## Variants

`Black` | Colour #0 (foreground code `30`, background code `40`). This is not necessarily the background colour, and using it as one may render the text hard to read on terminals with dark backgrounds. |
`Red` | Colour #1 (foreground code `31`, background code `41`). |
`Green` | Colour #2 (foreground code `32`, background code `42`). |
`Yellow` | Colour #3 (foreground code `33`, background code `43`). |
`Blue` | Colour #4 (foreground code `34`, background code `44`). |
`Purple` | Colour #5 (foreground code `35`, background code `45`). |
`Cyan` | Colour #6 (foreground code `36`, background code `46`). |
`White` | Colour #7 (foreground code `37`, background code `47`). As above, this is not necessarily the foreground colour, and may be hard to read on terminals with light backgrounds. |
`Fixed` | A colour number from 0 to 255, for use in 256-colour terminal environments. Colours 0 to 7 are the `Black` to `White` variants respectively. These colours can usually be changed in the terminal emulator. Colours 8 to 15 are brighter versions of the eight colours above. These can also usually be changed in the terminal emulator, or it could be configured to use the original colours and show the text in bold instead. It varies depending on the program. Colours 16 to 231 contain several palettes of bright colours, arranged in six squares measuring six by six each. Colours 232 to 255 are shades of grey from black to white. It might make more sense to look at a colour chart. |

## Methods

### `impl Colour`

#### `fn normal(self) -> Style`

Return a Style with the foreground colour set to this colour.

#### `fn paint<'a, S>(self, input: S) -> ANSIString<'a> where S: Into<Cow<'a, str>>`

Paints the given text with this colour, returning an ANSI string. This is a short-cut so you don't have to use Blue.normal() just to get blue text.

#### `fn bold(self) -> Style`

Returns a Style with the bold property set.

#### `fn dimmed(self) -> Style`

Returns a Style with the dimmed property set.

#### `fn italic(self) -> Style`

Returns a Style with the italic property set.

#### `fn underline(self) -> Style`

Returns a Style with the underline property set.

#### `fn blink(self) -> Style`

Returns a Style with the blink property set.

#### `fn reverse(self) -> Style`

Returns a Style with the reverse property set.

#### `fn hidden(self) -> Style`

Returns a Style with the hidden property set.

#### `fn on(self, background: Colour) -> Style`

Returns a Style with the background colour property set.

## Trait Implementations

### Derived Implementations

### `impl Debug for Colour`

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`

### `impl Copy for Colour`

### `impl Clone for Colour`

#### `fn clone(&self) -> Colour`

#### `fn clone_from(&mut self, source: &Self)`1.0.0

### `impl PartialEq for Colour`

#### `fn eq(&self, __arg_0: &Colour) -> bool`

#### `fn ne(&self, __arg_0: &Colour) -> bool`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)