text_color
Definition: | text_color(integer i) |
Description: | Set the console window foreground text color.
The following values (0..15, see psym.e or graphics.e) may be used: BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, WHITE, GRAY, BRIGHT_BLUE, BRIGHT_GREEN, BRIGHT_CYAN, BRIGHT_RED, BRIGHT_MAGENTA, YELLOW, BRIGHT_WHITE |
pwa/p2js: | Supported, not that I particularly recommend it. Note that as per the comments below there may be some differences between running pwa/p2js on Windows or Linux. |
Comments: | Text displayed on a console
after
calling text_color() will have the desired color.
Note that the constants were copied verbatim from Euphoria, and differ between Windows and Linux. Hence while (eg) text_color(BLUE) will be consistent between those platforms, any programs which loop 0..15, such as demo/rosetta/Coloured_text.exw, are likely to look fairly different. Ideally I might choose to use consistent numbers instead, with a little mapping at the point of use, but then some programs such as the one mentioned above, or perhaps more importantly some legacy code you are trying to convert, c/would behave differently on Euphoria and Phix. |
Example: |
text_color(BRIGHT_BLUE) For use in a complete application, see demo\color.exw or demo\rosetta\Coloured_text.exw |
Implementation: | via :%opTxtClr / set_console_color() in builtins\VM\pfileioN.e (an autoinclude), or via a <span> in p2js.js |
See Also: | bk_color |