Colour bars/Display: Difference between revisions
Content added Content deleted
No edit summary |
m (→{{header|REXX}}: changed/added comments and whitespace, changed indentations.) |
||
Line 858: | Line 858: | ||
{{works with|R4}} |
{{works with|R4}} |
||
{{works with|ROO}} |
{{works with|ROO}} |
||
⚫ | Programming note: because of the way the REXX interpreters (being used for this example) ensure screen output fidelity, if ninety characters are displayed on a ninety-byte wide screen, REXX apparently forces an extra blank, causing to what appears to be a blank line after the line displayed. Because of this, the last color bar ('''_.8''') has been shortened by one byte. |
||
<br> |
|||
<lang rexx>/*REXX program displays eight colored vertical bars on the full screen. */ |
|||
⚫ | Programming note: because of the way the REXX interpreters (being used for this example) ensure screen output fidelity, if ninety characters are displayed on a ninety-byte wide screen, REXX apparently forces an extra blank, causing to what appears to be a blank line after the line displayed. Because of this, the last color bar ('''_.8''') has been shortened by one byte. |
||
parse value scrsize() with sd sw . /*screen depth,width.*/ |
|||
⚫ | |||
<lang rexx>/*REXX program displays eight colored vertical bars on a full screen. */ |
|||
parse value scrsize() with sd sw . /*the screen depth and width. */ |
|||
⚫ | |||
$ = x2c('1b5b73') || x2c('1b5b313b33376d') /* preamble, header. */ |
|||
_.=copies('db'x, barWidth) /*the bar, full width. */ |
|||
_.8=left(_.,barWidth-1) /*the last bar width, less one. */ |
|||
$ = x2c('1b5b73') || x2c("1b5b313b33376d") /* the preamble, and the header. */ |
|||
hdr. |
hdr.1 = x2c('1b5b303b33306d') /* " color black. */ |
||
hdr. |
hdr.2 = x2c('1b5b313b33316d') /* " color red. */ |
||
hdr. |
hdr.3 = x2c('1b5b313b33326d') /* " color green. */ |
||
hdr. |
hdr.4 = x2c('1b5b313b33346d') /* " color blue. */ |
||
hdr. |
hdr.5 = x2c('1b5b313b33356d') /* " color magenta. */ |
||
hdr.6 = x2c('1b5b313b33366d') /* " color cyan. */ |
|||
⚫ | |||
hdr.7 = x2c('1b5b313b33336d') /* " color yellow. */ |
|||
hdr.8 = x2c('1b5b313b33376d') /* " color white. */ |
|||
⚫ | |||
$=$ || hdr.j || _.j /*append the color header + bar. */ |
|||
/* [↓] last bar width is shrunk. */ |
|||
do j=1 for 8 /*build the line, color by color. */ |
|||
$=$ || |
$=$ || hdr.j || _.j /*append the color header + bar. */ |
||
/* [ |
end /*j*/ /* [↑] color order is the list. */ |
||
/* [↓] the tail is overkill. */ |
|||
$=$ || tail /*append the epilogue (trailer). */ |
|||
/* [↓] show full screen of bars. */ |
|||
/* |
do k=1 for sd /*SD = screen depth (from above). */ |
||
say $ /*have REXX display line of bars. */ |
|||
⚫ | |||
end /*k*/ /* [↑] Note: SD could be zero. */ |
|||
/*stick a fork in it, we're done. */</lang> |
|||
⚫ | |||
=={{header|Ring}}== |
=={{header|Ring}}== |