class Colors::ColorValue

Overview

The value one primary color has out of a RGB color.

Defined in:

colors/color_value.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(value : UInt8 = MIN_INTENSITY) #

def self.new(value : AnyNumber | ColorValue) #

Create a ColorValue from a number or another color value.

Raises OverflowError if the value won't fit in a UInt8; I.E. if the value is less than 0 or greater than 255, or not an integer; E.G. 3.0, 100u64, 255f64, or ColorValue::new(100u8) are acceptable parameters, -1, 256u16, or 123.456 will throw.


def self.new(value : String = "0") #

Create a ColorValue from a string representation: either a hexadecimal numeric value between 0 and 255, or the words "full" or "off" which translate to MAX_INTENSITY and MIN_INTENSITY, respectively.

Raises if the value isn't a valid base-16 integer which fits into 8 bits, unsigned.


Class Method Detail

def self.full #

def self.max #

def self.min #

def self.off #

Instance Method Detail

def %(other) #

Defines a new color where this color % other


def &(other) #

Defines a new color where this color & other


def *(other) #

Defines a new color where this color * other


def +(other) #

Defines a new color where this color + other


def -(other) #

Defines a new color where this color - other


def /(other) #

Defines a new color where this color / other


def <(other) #

def <=(other) #

def ==(other) #
Description copied from class Reference

Returns false (other can only be a Value here).


def >(other) #

def >=(other) #

def ^(other) #

Defines a new color where this color ^ other


def abs : UInt8 #

def to_f #

def to_i #

def to_s(io) #

def to_u8 : UInt8 #

def |(other) #

Defines a new color where this color | other