Fan

 

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

alphaSource

Int alpha()

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

argbSource

const Int argb

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

bSource

Int b()

The blue component from 0 to 255.

blackSource

static Color black := Color.make(0)

Constant for 0x00_00_00

blueSource

static Color blue := Color.make(255)

Constant for 0x00_00_ff

darkGraySource

static Color darkGray := Color.make(11119017)

Constant for 0xa9_a9_a9

disposeSource

native Void dispose()

Free any operating system resources used by this instance.

equalsSource

override Bool equals(Obj? that)

Overrides sys::Obj.equals

Return argb as the hash code.

fromStrSource

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")
gSource

Int g()

The green component from 0 to 255.

graySource

static Color gray := Color.make(8421504)

Constant for 0x80_80_80

greenSource

static Color green := Color.make(65280)

Constant for 0x00_ff_00

hashSource

override Int hash()

Overrides sys::Obj.hash

Return argb as the hash code.

makeSource

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.

orangeSource

static Color orange := Color.make(16753920)

Constant for 0xff_a5_00

purpleSource

static Color purple := Color.make(8388736)

Constant for 0x80_00_80

rSource

Int r()

The red component from 0 to 255.

redSource

static Color red := Color.make(16711680)

Constant for 0xff_00_00

rgbSource

Int rgb()

Get the RGB bitmask without the alpha bits.

sysBgSource

static native Color sysBg()

System color for background on widgets

sysBorderSource

static native Color sysBorder()

System color for borders on widgets

sysDarkShadowSource

static native Color sysDarkShadow()

System color for dark shadow on widgets

sysFgSource

static native Color sysFg()

System color for foreground and text on widgets

sysHighlightShadowSource

static native Color sysHighlightShadow()

System color for highlight shadow on widgets

sysLightShadowSource

static native Color sysLightShadow()

System color for light shadow on widgets

sysListBgSource

static native Color sysListBg()

System color for list background.

sysListFgSource

static native Color sysListFg()

System color for list text.

sysListSelBgSource

static native Color sysListSelBg()

System color for list selection background.

sysListSelFgSource

static native Color sysListSelFg()

System color for list selection text.

sysNormShadowSource

static native Color sysNormShadow()

System color for normal shadow on widgets

toStrSource

override Str toStr()

Overrides sys::Obj.toStr

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

whiteSource

static Color white := Color.make(16777215)

Constant for 0xff_ff_ff

yellowSource

static Color yellow := Color.make(16776960)

Constant for 0xff_ff_00