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.


def self.new(pull parser : JSON::PullParser) #

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

Class Method Detail

def self.black #

A zero Color.


def self.blue(intensity : AnyNumber | ColorValue = ColorValue.full) #

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


def self.gray(intensity : AnyNumber | ColorValue = ColorValue.new(136)) #

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


def self.green(intensity : AnyNumber | ColorValue = ColorValue.full) #

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


def self.grey(intensity : AnyNumber | ColorValue = ColorValue.new(136)) #

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


def self.random #

def self.red(intensity : AnyNumber | ColorValue = ColorValue.full) #

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


def self.white #

A Color with all values set to the maximum.


def self.zero #

A zero Color.


Instance Method Detail

def blue : Colors::ColorValue #

def blue=(blue) #

def colorize(text : String) #

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


def green : Colors::ColorValue #

def green=(green) #

def red : Colors::ColorValue #

def red=(red) #

def to_json(builder) #

def to_json #

def to_s #

Return the standard #XXXXXX hexadecimal representation of this Color