Class: TCOD::Color

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/libtcod/bindings.rb,
lib/libtcod/color_consts.rb

Overview

Color module

Constant Summary collapse

BLACK =

default colors grey levels

Color.rgb(0,0,0)
DARKEST_GREY =
Color.rgb(31,31,31)
DARKER_GREY =
Color.rgb(63,63,63)
DARK_GREY =
Color.rgb(95,95,95)
GREY =
Color.rgb(127,127,127)
LIGHT_GREY =
Color.rgb(159,159,159)
LIGHTER_GREY =
Color.rgb(191,191,191)
LIGHTEST_GREY =
Color.rgb(223,223,223)
DARKEST_GRAY =
Color.rgb(31,31,31)
DARKER_GRAY =
Color.rgb(63,63,63)
DARK_GRAY =
Color.rgb(95,95,95)
GRAY =
Color.rgb(127,127,127)
LIGHT_GRAY =
Color.rgb(159,159,159)
LIGHTER_GRAY =
Color.rgb(191,191,191)
LIGHTEST_GRAY =
Color.rgb(223,223,223)
WHITE =
Color.rgb(255,255,255)
DARKEST_SEPIA =

sepia

Color.rgb(31,24,15)
DARKER_SEPIA =
Color.rgb(63,50,31)
DARK_SEPIA =
Color.rgb(94,75,47)
SEPIA =
Color.rgb(127,101,63)
LIGHT_SEPIA =
Color.rgb(158,134,100)
LIGHTER_SEPIA =
Color.rgb(191,171,143)
LIGHTEST_SEPIA =
Color.rgb(222,211,195)
RED =

standard colors

Color.rgb(255,0,0)
FLAME =
Color.rgb(255,63,0)
ORANGE =
Color.rgb(255,127,0)
AMBER =
Color.rgb(255,191,0)
YELLOW =
Color.rgb(255,255,0)
LIME =
Color.rgb(191,255,0)
CHARTREUSE =
Color.rgb(127,255,0)
GREEN =
Color.rgb(0,255,0)
SEA =
Color.rgb(0,255,127)
TURQUOISE =
Color.rgb(0,255,191)
CYAN =
Color.rgb(0,255,255)
SKY =
Color.rgb(0,191,255)
AZURE =
Color.rgb(0,127,255)
BLUE =
Color.rgb(0,0,255)
HAN =
Color.rgb(63,0,255)
VIOLET =
Color.rgb(127,0,255)
PURPLE =
Color.rgb(191,0,255)
FUCHSIA =
Color.rgb(255,0,255)
MAGENTA =
Color.rgb(255,0,191)
PINK =
Color.rgb(255,0,127)
CRIMSON =
Color.rgb(255,0,63)
DARK_RED =

dark colors

Color.rgb(191,0,0)
DARK_FLAME =
Color.rgb(191,47,0)
DARK_ORANGE =
Color.rgb(191,95,0)
DARK_AMBER =
Color.rgb(191,143,0)
DARK_YELLOW =
Color.rgb(191,191,0)
DARK_LIME =
Color.rgb(143,191,0)
DARK_CHARTREUSE =
Color.rgb(95,191,0)
DARK_GREEN =
Color.rgb(0,191,0)
DARK_SEA =
Color.rgb(0,191,95)
DARK_TURQUOISE =
Color.rgb(0,191,143)
DARK_CYAN =
Color.rgb(0,191,191)
DARK_SKY =
Color.rgb(0,143,191)
DARK_AZURE =
Color.rgb(0,95,191)
DARK_BLUE =
Color.rgb(0,0,191)
DARK_HAN =
Color.rgb(47,0,191)
DARK_VIOLET =
Color.rgb(95,0,191)
DARK_PURPLE =
Color.rgb(143,0,191)
DARK_FUCHSIA =
Color.rgb(191,0,191)
DARK_MAGENTA =
Color.rgb(191,0,143)
DARK_PINK =
Color.rgb(191,0,95)
DARK_CRIMSON =
Color.rgb(191,0,47)
DARKER_RED =

darker colors

Color.rgb(127,0,0)
DARKER_FLAME =
Color.rgb(127,31,0)
DARKER_ORANGE =
Color.rgb(127,63,0)
DARKER_AMBER =
Color.rgb(127,95,0)
DARKER_YELLOW =
Color.rgb(127,127,0)
DARKER_LIME =
Color.rgb(95,127,0)
DARKER_CHARTREUSE =
Color.rgb(63,127,0)
DARKER_GREEN =
Color.rgb(0,127,0)
DARKER_SEA =
Color.rgb(0,127,63)
DARKER_TURQUOISE =
Color.rgb(0,127,95)
DARKER_CYAN =
Color.rgb(0,127,127)
DARKER_SKY =
Color.rgb(0,95,127)
DARKER_AZURE =
Color.rgb(0,63,127)
DARKER_BLUE =
Color.rgb(0,0,127)
DARKER_HAN =
Color.rgb(31,0,127)
DARKER_VIOLET =
Color.rgb(63,0,127)
DARKER_PURPLE =
Color.rgb(95,0,127)
DARKER_FUCHSIA =
Color.rgb(127,0,127)
DARKER_MAGENTA =
Color.rgb(127,0,95)
DARKER_PINK =
Color.rgb(127,0,63)
DARKER_CRIMSON =
Color.rgb(127,0,31)
DARKEST_RED =

darkest colors

Color.rgb(63,0,0)
DARKEST_FLAME =
Color.rgb(63,15,0)
DARKEST_ORANGE =
Color.rgb(63,31,0)
DARKEST_AMBER =
Color.rgb(63,47,0)
DARKEST_YELLOW =
Color.rgb(63,63,0)
DARKEST_LIME =
Color.rgb(47,63,0)
DARKEST_CHARTREUSE =
Color.rgb(31,63,0)
DARKEST_GREEN =
Color.rgb(0,63,0)
DARKEST_SEA =
Color.rgb(0,63,31)
DARKEST_TURQUOISE =
Color.rgb(0,63,47)
DARKEST_CYAN =
Color.rgb(0,63,63)
DARKEST_SKY =
Color.rgb(0,47,63)
DARKEST_AZURE =
Color.rgb(0,31,63)
DARKEST_BLUE =
Color.rgb(0,0,63)
DARKEST_HAN =
Color.rgb(15,0,63)
DARKEST_VIOLET =
Color.rgb(31,0,63)
DARKEST_PURPLE =
Color.rgb(47,0,63)
DARKEST_FUCHSIA =
Color.rgb(63,0,63)
DARKEST_MAGENTA =
Color.rgb(63,0,47)
DARKEST_PINK =
Color.rgb(63,0,31)
DARKEST_CRIMSON =
Color.rgb(63,0,15)
LIGHT_RED =

light colors

Color.rgb(255,114,114)
LIGHT_FLAME =
Color.rgb(255,149,114)
LIGHT_ORANGE =
Color.rgb(255,184,114)
LIGHT_AMBER =
Color.rgb(255,219,114)
LIGHT_YELLOW =
Color.rgb(255,255,114)
LIGHT_LIME =
Color.rgb(219,255,114)
LIGHT_CHARTREUSE =
Color.rgb(184,255,114)
LIGHT_GREEN =
Color.rgb(114,255,114)
LIGHT_SEA =
Color.rgb(114,255,184)
LIGHT_TURQUOISE =
Color.rgb(114,255,219)
LIGHT_CYAN =
Color.rgb(114,255,255)
LIGHT_SKY =
Color.rgb(114,219,255)
LIGHT_AZURE =
Color.rgb(114,184,255)
LIGHT_BLUE =
Color.rgb(114,114,255)
LIGHT_HAN =
Color.rgb(149,114,255)
LIGHT_VIOLET =
Color.rgb(184,114,255)
LIGHT_PURPLE =
Color.rgb(219,114,255)
LIGHT_FUCHSIA =
Color.rgb(255,114,255)
LIGHT_MAGENTA =
Color.rgb(255,114,219)
LIGHT_PINK =
Color.rgb(255,114,184)
LIGHT_CRIMSON =
Color.rgb(255,114,149)
LIGHTER_RED =

lighter colors

Color.rgb(255,165,165)
LIGHTER_FLAME =
Color.rgb(255,188,165)
LIGHTER_ORANGE =
Color.rgb(255,210,165)
LIGHTER_AMBER =
Color.rgb(255,232,165)
LIGHTER_YELLOW =
Color.rgb(255,255,165)
LIGHTER_LIME =
Color.rgb(232,255,165)
LIGHTER_CHARTREUSE =
Color.rgb(210,255,165)
LIGHTER_GREEN =
Color.rgb(165,255,165)
LIGHTER_SEA =
Color.rgb(165,255,210)
LIGHTER_TURQUOISE =
Color.rgb(165,255,232)
LIGHTER_CYAN =
Color.rgb(165,255,255)
LIGHTER_SKY =
Color.rgb(165,232,255)
LIGHTER_AZURE =
Color.rgb(165,210,255)
LIGHTER_BLUE =
Color.rgb(165,165,255)
LIGHTER_HAN =
Color.rgb(188,165,255)
LIGHTER_VIOLET =
Color.rgb(210,165,255)
LIGHTER_PURPLE =
Color.rgb(232,165,255)
LIGHTER_FUCHSIA =
Color.rgb(255,165,255)
LIGHTER_MAGENTA =
Color.rgb(255,165,232)
LIGHTER_PINK =
Color.rgb(255,165,210)
LIGHTER_CRIMSON =
Color.rgb(255,165,188)
LIGHTEST_RED =

lightest colors

Color.rgb(255,191,191)
LIGHTEST_FLAME =
Color.rgb(255,207,191)
LIGHTEST_ORANGE =
Color.rgb(255,223,191)
LIGHTEST_AMBER =
Color.rgb(255,239,191)
LIGHTEST_YELLOW =
Color.rgb(255,255,191)
LIGHTEST_LIME =
Color.rgb(239,255,191)
LIGHTEST_CHARTREUSE =
Color.rgb(223,255,191)
LIGHTEST_GREEN =
Color.rgb(191,255,191)
LIGHTEST_SEA =
Color.rgb(191,255,223)
LIGHTEST_TURQUOISE =
Color.rgb(191,255,239)
LIGHTEST_CYAN =
Color.rgb(191,255,255)
LIGHTEST_SKY =
Color.rgb(191,239,255)
LIGHTEST_AZURE =
Color.rgb(191,223,255)
LIGHTEST_BLUE =
Color.rgb(191,191,255)
LIGHTEST_HAN =
Color.rgb(207,191,255)
LIGHTEST_VIOLET =
Color.rgb(223,191,255)
LIGHTEST_PURPLE =
Color.rgb(239,191,255)
LIGHTEST_FUCHSIA =
Color.rgb(255,191,255)
LIGHTEST_MAGENTA =
Color.rgb(255,191,239)
LIGHTEST_PINK =
Color.rgb(255,191,223)
LIGHTEST_CRIMSON =
Color.rgb(255,191,207)
DESATURATED_RED =

desaturated colors

Color.rgb(127,63,63)
DESATURATED_FLAME =
Color.rgb(127,79,63)
DESATURATED_ORANGE =
Color.rgb(127,95,63)
DESATURATED_AMBER =
Color.rgb(127,111,63)
DESATURATED_YELLOW =
Color.rgb(127,127,63)
DESATURATED_LIME =
Color.rgb(111,127,63)
DESATURATED_CHARTREUSE =
Color.rgb(95,127,63)
DESATURATED_GREEN =
Color.rgb(63,127,63)
DESATURATED_SEA =
Color.rgb(63,127,95)
DESATURATED_TURQUOISE =
Color.rgb(63,127,111)
DESATURATED_CYAN =
Color.rgb(63,127,127)
DESATURATED_SKY =
Color.rgb(63,111,127)
DESATURATED_AZURE =
Color.rgb(63,95,127)
DESATURATED_BLUE =
Color.rgb(63,63,127)
DESATURATED_HAN =
Color.rgb(79,63,127)
DESATURATED_VIOLET =
Color.rgb(95,63,127)
DESATURATED_PURPLE =
Color.rgb(111,63,127)
DESATURATED_FUCHSIA =
Color.rgb(127,63,127)
DESATURATED_MAGENTA =
Color.rgb(127,63,111)
DESATURATED_PINK =
Color.rgb(127,63,95)
DESATURATED_CRIMSON =
Color.rgb(127,63,79)
BRASS =

metallic

Color.rgb(191,151,96)
COPPER =
Color.rgb(197,136,124)
GOLD =
Color.rgb(229,191,0)
SILVER =
Color.rgb(203,203,203)
CELADON =

miscellaneous

Color.rgb(172,255,175)
PEACH =
Color.rgb(255,159,127)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hsv(h, s, v) ⇒ Object



40
41
42
# File 'lib/libtcod/bindings.rb', line 40

def self.hsv(h,s,v)
 TCOD.color_HSV(h,s,v)
end

.rgb(r, g, b) ⇒ Object



36
37
38
# File 'lib/libtcod/bindings.rb', line 36

def self.rgb(r,g,b)
  TCOD.color_RGB(r,g,b)
end

Instance Method Details

#*(col_or_float) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/libtcod/bindings.rb', line 48

def *(col_or_float)
  if col_or_float.is_a? Color
    TCOD.color_multiply(self, col_or_float)
  else
    TCOD.color_multiply_scalar(self, col_or_float)
  end
end

#==(col) ⇒ Object



44
45
46
# File 'lib/libtcod/bindings.rb', line 44

def ==(col)
  TCOD.color_equals(self, col)
end

#to_sObject



56
57
58
# File 'lib/libtcod/bindings.rb', line 56

def to_s
  "<Color #{self[:r]}, #{self[:g]}, #{self[:b]}>"
end