Class: Sickill::Rainbow::RGB

Inherits:
Object
  • Object
show all
Defined in:
lib/ansi_rgb.rb

Overview

Helper class for RGB color format.

Class Method Summary collapse

Class Method Details

.outside_range?(rgb) ⇒ Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/ansi_rgb.rb', line 32

def self.outside_range?(rgb)
  rgb.min < 0 or rgb.max > 255
end

.to_ansi_domain(value) ⇒ Object

Change domain of color value from 0-255 to 0-5


37
38
39
# File 'lib/ansi_rgb.rb', line 37

def self.to_ansi_domain(value)
  (6 * (value / 256.0)).to_i
end