RosettaCodeData/Task/Terminal-control-Coloured-text/FutureBasic/terminal-control-coloured-t...

43 lines
1022 B
Plaintext

// Terminal control/Coloured text
// https://rosettacode.org/wiki/Terminal_control/Coloured_text#FreeBASIC
_Window = 1
window _Window,@"Flashing Colored Text",fn cgrectmake(0,0,400,400)
windowcenter(_Window)
WindowSetBackgroundColor(_Window,fn ColorBlack)
bool FlashingColor
local fn WordColors
short Color
IF FlashingColor = 0
FlashingColor = 1
ELSE
FlashingColor = 0
END IF
cls
for Color = 1 to 8
if FlashingColor
text @"Menlo",30,_zBlack,_zBlack
print @(1,Color), @"Flashing Color"
else
if Color = 1 then text @"Menlo",30,_zYellow,_zBlue
if Color = 2 then text @"Menlo",30,_zGreen,_zBlack
if Color = 3 then text @"Menlo",30,_zCyan,_zYellow
if Color = 4 then text @"Menlo",30,_zBlue,_zWhite
if Color = 5 then text @"Menlo",30,_zMagenta,_zYellow
if Color = 6 then text @"Menlo",30,_zRed,_zBlack
if Color = 7 then text @"Menlo",30,_zWhite,_zBlue
if Color = 8 then text @"Menlo",30,_zBrown,_zWhite
print @(1,Color), @"Flashing Color"
end if
next Color
end fn
fn AppSetTimer( 1, @fn WordColors, _true )
handleevents