Terminal control/Coloured text: Difference between revisions
Content deleted Content added
m →{{header|Forth}}: fixed </LANG> tag |
m →{{header|Phix}}: now p2js compatible |
||
Line 1,458: | Line 1,458: | ||
{{trans|PureBasic}} |
{{trans|PureBasic}} |
||
The following builtin constants (0..15) may be used: |
The following builtin constants (0..15) may be used: |
||
BLACK, BLUE, |
BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, WHITE, GRAY, |
||
BRIGHT_BLUE, BRIGHT_GREEN, BRIGHT_CYAN, BRIGHT_RED, BRIGHT_MAGENTA, |
|||
⚫ | |||
YELLOW, BRIGHT_WHITE |
|||
⚫ | |||
<span style="color: #000080;font-style:italic;">-- |
<span style="color: #000080;font-style:italic;">-- |
||
-- demo\rosetta\Coloured_text.exw |
-- demo\rosetta\Coloured_text.exw |
||
-- |
-- ============================== |
||
--</span> |
--</span> |
||
<span style="color: # |
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
||
<span style="color: # |
<span style="color: #7060A8;">text_color</span><span style="color: #0000FF;">(</span><span style="color: #004600;">GRAY</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #7060A8;">bk_color</span><span style="color: #0000FF;">(</span><span style="color: #004600;">BLACK</span><span style="color: #0000FF;">)</span> |
|||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Background color# 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15\n"</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Background color# 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15\n"</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">" -----------------------------------------------\n"</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">" -----------------------------------------------\n"</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #008080;">for</span> <span style="color: #000000;">foreground</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">to</span> <span style="color: #000000;">15</span> <span style="color: #008080;">do</span> |
<span style="color: #008080;">for</span> <span style="color: #000000;">foreground</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">to</span> <span style="color: #000000;">15</span> <span style="color: #008080;">do</span> |
||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Foreground color# %02d "</span><span style="color: #0000FF;">,</span><span style="color: #000000;">foreground</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Foreground color# %02d "</span><span style="color: #0000FF;">,</span><span style="color: #000000;">foreground</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #008080;">for</span> <span style="color: # |
<span style="color: #008080;">for</span> <span style="color: #000000;">background</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">to</span> <span style="color: #000000;">15</span> <span style="color: #008080;">do</span> |
||
<span style="color: # |
<span style="color: #7060A8;">text_color</span><span style="color: #0000FF;">(</span><span style="color: #000000;">foreground</span><span style="color: #0000FF;">)</span> |
||
<span style="color: # |
<span style="color: #7060A8;">bk_color</span><span style="color: #0000FF;">(</span><span style="color: #000000;">background</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%02d"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">foreground</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%02d"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">foreground</span><span style="color: #0000FF;">)</span> |
||
<span style="color: # |
<span style="color: #7060A8;">text_color</span><span style="color: #0000FF;">(</span><span style="color: #004600;">GRAY</span><span style="color: #0000FF;">)</span> |
||
<span style="color: # |
<span style="color: #7060A8;">bk_color</span><span style="color: #0000FF;">(</span><span style="color: #004600;">BLACK</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">" "</span><span style="color: #0000FF;">)</span> |
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">" "</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span> |
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span> |