Colour bars/Display: Difference between revisions

→‎{{header|PicoLisp}}: Added PureBasic
m (→‎{{header|Tcl}}: Turn off focus ring)
(→‎{{header|PicoLisp}}: Added PureBasic)
Line 14:
 
(call 'tput 'sgr0) # reset</lang>
=={{header|PureBasic}}==
Press Enter or Escape to exit the program.
<lang PureBasic>Dim color(7)
color(0) = RGB($00, $00, $00) ;black
color(1) = RGB($FF, $00, $00) ;red
color(2) = RGB($00, $FF, $00) ;green
color(3) = RGB($00, $00, $FF) ;blue
color(4) = RGB($FF, $00, $FF) ;magenta
color(5) = RGB($00, $FF, $FF) ;cyan
color(6) = RGB($FF, $FF, $00) ;yellow
color(7) = RGB($FF, $FF, $FF) ;white
 
If Not InitKeyboard(): End: EndIf ;can't init keyboard
If Not InitSprite(): End: EndIf ;can't init sprite/screen library
If Not ExamineDesktops(): End: EndIf ;can't retrieve information about desktop
 
height = DesktopHeight(0)
width = DesktopWidth(0)
depth = DesktopDepth(0)
If OpenScreen(width, height, depth, "Press ENTER to exit")
StartDrawing(ScreenOutput())
For c = 0 To 7
Box((width * c) / 8, 0, width / 8, height, color(c))
Next
StopDrawing()
FlipBuffers()
Repeat
Delay(10)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Return)
CloseScreen()
EndIf</lang>
===Alternate method using console===
<lang PureBasic>DataSection
;Black, Red, Green, Blue, Magenta, Cyan, Yellow, White
Data.i 0, 12, 10, 9, 13, 11, 14, 15
EndDataSection
 
Dim colors(7)
For c = 0 To 7
Read.i colors(c)
Next
 
If OpenConsole()
;The console display is 80 columns wide by 25 rows
For r = 0 To 24
For c = 0 To 7
ConsoleColor(colors(c), colors(c))
Print(Space(80 / 8))
Next
Next
EnableGraphicalConsole(1)
ConsoleLocate(0, 0)
ConsoleTitle("Press ENTER to exit"): Input()
CloseConsole()
EndIf</lang>
 
=={{header|Tcl}}==
Anonymous user