ColorGreen ( )

Parameters

None.

Description

Returns the green component of the current drawing colour, 0 to 255.

The current colour is whatever the last Color set - or, after GetColor, the colour picked up from the screen. Together with ColorRed() and ColorBlue() it lets you read back GetColor's result, or save and restore the drawing colour around a routine that changes it.

See also: ColorRed, ColorBlue, Color, GetColor.

Example

; ColorGreen Example
; ------------------

Graphics 640,480,0,2
SetBuffer BackBuffer()

angle#=0

While Not KeyDown(1)

    Cls

    ; Smoothly cycle the drawing colour through a rainbow
    angle=angle+1
    Color 128+Sin(angle)*127,128+Sin(angle+120)*127,128+Sin(angle+240)*127

    ; Draw a swatch in the current drawing colour
    Rect 220,120,200,200,1

    ; ColorGreen reads back the green part of the current drawing colour
    g=ColorGreen()

    ; Bar showing just the green component
    Color 0,255,0
    Rect 20,420,g,20,1
    Rect 20,420,256,20,0

    Color 255,255,255
    Text 0,0,"Esc: exit"
    Text 0,20,"ColorGreen() = "+g

    Flip

Wend

End

Index