struct

Obelisk::Color

Inherits Struct < Value < Object

Represents a color with RGB values

Constants

BLACK = Color.new(0_u8, 0_u8, 0_u8)

Common colors

BLUE = Color.new(0_u8, 0_u8, 255_u8)
GREEN = Color.new(0_u8, 255_u8, 0_u8)
RED = Color.new(255_u8, 0_u8, 0_u8)
TRANSPARENT = Color.new(0_u8, 0_u8, 0_u8)
WHITE = Color.new(255_u8, 255_u8, 255_u8)

Constructors

from_hex(hex : String) : Color

Create color from hex string

Source
new(red : UInt8, green : UInt8, blue : UInt8)
Source

Instance methods

blue
Source
brighten(factor : Float64) : Color

Brighten the color by a factor

Source
brightness

Calculate brightness (0.0 to 1.0)

Source
darken(factor : Float64) : Color

Darken the color by a factor

Source
green
Source
to_hex

Convert to hex string

Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source
transparent?

Check if color is transparent (all zeros)

Source