class Colors::Color

Defined in:

colors/color.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.from_s(string : String) : Color #

Accepts a string like "#RRGGBB", returns a new Color. Raises an exception if the string is not in that format.


[View source]
def self.new(pull parser : JSON::PullParser) #

[View source]
def self.new(red : AnyNumber | ColorValue = ColorValue.off, green : AnyNumber | ColorValue = ColorValue.off, blue : AnyNumber | ColorValue = ColorValue.off) #

[View source]

Class Method Detail

def self.black #

A zero Color.


[View source]
def self.blue(intensity : AnyNumber | ColorValue = ColorValue.full) #

A Color with @blue set to the given value and the other colors off.


[View source]
def self.gray(intensity : AnyNumber | ColorValue = ColorValue.new(136)) #

A Color where each primary color's value is equal.


[View source]
def self.green(intensity : AnyNumber | ColorValue = ColorValue.full) #

A Color with @green set to the given value and the other colors off.


[View source]
def self.grey(intensity : AnyNumber | ColorValue = ColorValue.new(136)) #

A Color where each primary color's value is equal.


[View source]
def self.random #

[View source]
def self.red(intensity : AnyNumber | ColorValue = ColorValue.full) #

A Color with @red set to the given value and the other colors off.


[View source]
def self.white #

A Color with all values set to the maximum.


[View source]
def self.zero #

A zero Color.


[View source]

Instance Method Detail

def blue : Colors::ColorValue #

[View source]
def blue=(blue : Colors::ColorValue) #

[View source]
def colorize(text : String) #

Return the given text as a colorized value for display in terminals.


[View source]
def green : Colors::ColorValue #

[View source]
def green=(green : Colors::ColorValue) #

[View source]
def red : Colors::ColorValue #

[View source]
def red=(red : Colors::ColorValue) #

[View source]
def to_json(builder) #

[View source]
def to_json #

[View source]
def to_s #

Return the standard #XXXXXX hexadecimal representation of this Color


[View source]