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
Colorwith@blueset to the given value and the other colors off. -
.gray(intensity : AnyNumber | ColorValue = ColorValue.new(136))
A
Colorwhere each primary color's value is equal. -
.green(intensity : AnyNumber | ColorValue = ColorValue.full)
A
Colorwith@greenset to the given value and the other colors off. -
.grey(intensity : AnyNumber | ColorValue = ColorValue.new(136))
A
Colorwhere each primary color's value is equal. - .random
-
.red(intensity : AnyNumber | ColorValue = ColorValue.full)
A
Colorwith@redset to the given value and the other colors off. -
.white
A
Colorwith 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
#XXXXXXhexadecimal 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)
#