# ri > Thor::Shell::Color

---
type: CommandReference
command: Thor::Shell::Color
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `set_color(string, foreground, background=nil, bold=false)` — apply ANSI color to a string
- `can_display_colors?` — check if terminal supports ANSI color output
- `are_colors_disabled?` — check if color output has been explicitly disabled

## Name

Inherit from `Thor::Shell::Basic` and add set_color behavior.

## Synopsis

ruby
shell = Thor::Shell::Color.new
shell.say shell.set_color("Hello", :red, :on_white, :bold)
## Constants

- `BLACK` — Set the terminal's foreground ANSI color to black.
- `BLUE` — Set the terminal's foreground ANSI color to blue.
- `BOLD` — The start of an ANSI bold sequence.
- `CLEAR` — Embed in a String to clear all previous ANSI sequences.
- `CYAN` — Set the terminal's foreground ANSI color to cyan.
- `GREEN` — Set the terminal's foreground ANSI color to green.
- `MAGENTA` — Set the terminal's foreground ANSI color to magenta.
- `ON_BLACK` — Set the terminal's background ANSI color to black.
- `ON_BLUE` — Set the terminal's background ANSI color to blue.
- `ON_CYAN` — Set the terminal's background ANSI color to cyan.
- `ON_GREEN` — Set the terminal's background ANSI color to green.
- `ON_MAGENTA` — Set the terminal's background ANSI color to magenta.
- `ON_RED` — Set the terminal's background ANSI color to red.
- `ON_WHITE` — Set the terminal's background ANSI color to white.
- `ON_YELLOW` — Set the terminal's background ANSI color to yellow.
- `RED` — Set the terminal's foreground ANSI color to red.
- `WHITE` — Set the terminal's foreground ANSI color to white.
- `YELLOW` — Set the terminal's foreground ANSI color to yellow.

## Methods

- `are_colors_disabled?` — check if color output is disabled
- `can_display_colors?` — check if the terminal supports ANSI colors
- `set_color(string, foreground, background=nil, bold=false)` — apply ANSI formatting to a string. Returns the string with ANSI escape sequences embedded.

## Examples

ruby
shell = Thor::Shell::Color.new
shell.say shell.set_color("Error!", :red, :on_white, :bold)
## See Also

- [Thor::Shell::Basic](http://localhost/phpMan.php/perldoc/Thor%3A%3AShell%3A%3ABasic/markdown) — parent class with additional shell methods