class Colors::Color
- Colors::Color
- Reference
- Object
Defined in:
colors/color.crConstructors
-
.from_s(string : String) : Color
Accepts a string like "#RRGGBB", returns a new Color.
- .new(pull parser : JSON::PullParser)
- .new(red : AnyNumber | ColorValue = ColorValue.off, green : AnyNumber | ColorValue = ColorValue.off, blue : AnyNumber | ColorValue = ColorValue.off)
Class Method Summary
-
.black
A zero
Color
. -
.blue(intensity : AnyNumber | ColorValue = ColorValue.full)
A
Color
with@blue
set to the given value and the other colors off. -
.gray(intensity : AnyNumber | ColorValue = ColorValue.new(136))
A
Color
where each primary color's value is equal. -
.green(intensity : AnyNumber | ColorValue = ColorValue.full)
A
Color
with@green
set to the given value and the other colors off. -
.grey(intensity : AnyNumber | ColorValue = ColorValue.new(136))
A
Color
where each primary color's value is equal. - .random
-
.red(intensity : AnyNumber | ColorValue = ColorValue.full)
A
Color
with@red
set to the given value and the other colors off. -
.white
A
Color
with all values set to the maximum. -
.zero
A zero
Color
.
Instance Method Summary
- #blue : Colors::ColorValue
- #blue=(blue)
-
#colorize(text : String)
Return the given text as a colorized value for display in terminals.
- #green : Colors::ColorValue
- #green=(green)
- #red : Colors::ColorValue
- #red=(red)
- #to_json(builder)
- #to_json
-
#to_s
Return the standard
#XXXXXX
hexadecimal representation of thisColor
Constructor Detail
Accepts a string like "#RRGGBB", returns a new Color. Raises an exception if the string is not in that format.
def self.new(red : AnyNumber | ColorValue = ColorValue.off, green : AnyNumber | ColorValue = ColorValue.off, blue : AnyNumber | ColorValue = ColorValue.off)
#