Blitz3D+ Command Reference

ColorBlue ( )

Parameters

None.

Description

Returns the blue 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 ColorGreen() it lets you read back GetColor's result, or save and restore the drawing colour around a routine that changes it.

See also: ColorRed, ColorGreen, Color, GetColor.

Example

; ColorBlue 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

    ; ColorBlue reads back the blue part of the current drawing colour
    b=ColorBlue()

    ; Bar showing just the blue component
    Color 0,0,255
    Rect 20,420,b,20,1
    Rect 20,420,256,20,0

    Color 255,255,255
    Text 0,0,"Esc: exit"
    Text 0,20,"ColorBlue() = "+b

    Flip

Wend

End

Index