struct Termbox::Color

Overview

Translates any RGB color between terminal ouput modes (see OutputMode).

Defined in:

termbox2/color.cr

Constant Summary

Black = Color.new(*M8_COLORS[0])
Default = DefaultColor.new
Green = Color.new(*M8_COLORS[2])
M8_COLORS = { {0, 0, 0}, {128, 0, 0}, {0, 128, 0}, {128, 128, 0}, {0, 0, 128}, {128, 0, 128}, {0, 128, 128}, {192, 192, 192}, {128, 128, 128} }

RGBs of Mode::M8 colors.

Maroon = Color.new(*M8_COLORS[1])
Navy = Color.new(*M8_COLORS[4])
Olive = Color.new(*M8_COLORS[3])
Purple = Color.new(*M8_COLORS[5])
Silver = Color.new(*M8_COLORS[7])
Teal = Color.new(*M8_COLORS[6])
White = Color.new(255, 255, 255)

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from struct Termbox::IColor

|(also also_ : Color::Also) |, also also, for(mode : OutputMode) : UInt32 for, initialize initialize

Constructor methods inherited from struct Termbox::IColor

new new

Constructor Detail

def self.new(r : Int32, g : Int32, b : Int32, also : Termbox::Color::Also = Also::None) #

[View source]

Class Method Detail

def self.[](r, g, b) #

Shorthand for .new.


[View source]
def self.[](*, h, s, l) #

Shorthand for .new but converts the given HSL to RGB first.


[View source]

Instance Method Detail

def |(also also_ : Color::Also) #

Mixes also, an output-mode-independent attribute, into this color.


[View source]
def also : Termbox::Color::Also #
Description copied from struct Termbox::IColor

Returns this color's attribute.


def b : Int32 #

def clone #

[View source]
def copy_with(r _r = @r, g _g = @g, b _b = @b, also _also = @also) #

[View source]
def g : Int32 #

def m256 #

Returns M256 color (0-255) closest to this RGB color.


[View source]
def normal #

Returns normal color (0-8) closest to this RGB color.


[View source]
def r : Int32 #

def truecolor #

Returns true color for this RGB color.


[View source]