Colour bars/Display: Difference between revisions
Content deleted Content added
m →{{header|ZX Spectrum Basic}}: minor correction |
→Tcl: Added implementation |
||
Line 1: | Line 1: | ||
{{draft task}} |
{{draft task}} |
||
The task is to display a series of color bars across the width of the display. The color bars should either use the system palette, or the sequence of colors: Black, Red, Green, Blue, Magenta, Cyan, Yellow, White. |
The task is to display a series of color bars across the width of the display. The color bars should either use the system palette, or the sequence of colors: Black, Red, Green, Blue, Magenta, Cyan, Yellow, White. |
||
=={{header|Tcl}}== |
|||
{{libheader|Tk}} |
|||
<lang tcl>package require Tcl 8.5 |
|||
package require Tk 8.5 |
|||
wm attr . -fullscreen 1 |
|||
pack [canvas .c] -fill both -expand 1 |
|||
set colors {black red green blue magenta cyan yellow white} |
|||
for {set x 0} {$x < [winfo screenwidth c]} {incr x 8} { |
|||
.c create rectangle $x 0 [expr {$x+7}] [winfo screenheight c] \ |
|||
-fill [lindex $colors 0] -outline {} |
|||
set colors [list {*}[lrange $colors 1 end] [lindex $colors 0]] |
|||
}</lang> |
|||
== {{header|ZX Spectrum Basic}} == |
== {{header|ZX Spectrum Basic}} == |