logo

const class

fwt::Color

sys::Obj
  fwt::Color : fwt::Brush

Color models an ARGB color with an alpha, red, green, and blue component between 0 and 255. Color is also a solid Brush.

Slots

alpha

Int alpha()

The alpha component from 0 to 255, where 255 is opaque and 0 is transparent.

Source

argb

const Int argb

The ARGB components masked together: bits 31-24 alpha; bits 16-23 red; bits 8-15 green; bits 0-7 blue.

Source

b

Int b()

The blue component from 0 to 255.

Source

black

static Color black := Color.make(0)

Constant for 0x00_00_00

Source

blue

static Color blue := Color.make(255)

Constant for 0x00_00_ff

Source

darkGray

static Color darkGray := Color.make(11119017)

Constant for 0xa9_a9_a9

Source

dispose

native Void dispose()

Free any operating system resources used by this instance.

Source

equals

override Bool equals(Obj that)

Return argb as the hash code.

Source

fromStr

static Color fromStr(Str s, Bool checked := true)

Parse color from string (see toStr). If invalid and checked is true then throw ParseErr otherwise return null. The following formats are supported:

  • #AARRGGBB
  • #RRGGBB
  • #RGB

Examples:

Color.fromStr("#8A0")
Color.fromStr("#88AA00")
Color.fromStr("#d088aa00")

Source

g

Int g()

The green component from 0 to 255.

Source

gray

static Color gray := Color.make(8421504)

Constant for 0x80_80_80

Source

green

static Color green := Color.make(65280)

Constant for 0x00_ff_00

Source

hash

override Int hash()

Return argb as the hash code.

Source

make

new make(Int argb := 0, Bool hasAlpha := false)

Make a new instance with the ARGB components masked together: bits 31-24 alpha; bits 16-23 red; bits 8-15 green; bits 0-7 blue. If hasAlpha is false, then we assume the alpha bits are 0xFF.

Source

orange

static Color orange := Color.make(16753920)

Constant for 0xff_a5_00

Source

purple

static Color purple := Color.make(8388736)

Constant for 0x80_00_80

Source

r

Int r()

The red component from 0 to 255.

Source

red

static Color red := Color.make(16711680)

Constant for 0xff_00_00

Source

rgb

Int rgb()

Get the RGB bitmask without the alpha bits.

Source

toStr

override Str toStr()

If the alpha component is 255, then format as "#RRGGBB" hex string, otherwise format as "#AARRGGBB" hex string.

Source

white

static Color white := Color.make(16777215)

Constant for 0xff_ff_ff

Source

yellow

static Color yellow := Color.make(16776960)

Constant for 0xff_ff_00

Source