![]() |
Forum Index : Microcontroller and PC projects : Change Text Color
Author | Message | ||||
frnno967 Senior Member ![]() Joined: 02/10/2020 Location: United StatesPosts: 104 |
I couldn't understand from reading the CMM2 manual how to change the color of text on the VGA console. Is there a command to change it on the fly? Like if I want: TEXT ONE to be White on Black background TEXT TWO to be Green Thank you. Jay Crutti: Ham Radio Operator, K5JCJ. Computer Enthusiast. Musician. Engineer. |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Off the top of my head it is the final two parameters to the TEXT command, check the manual. Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Two methods depending on how you are printing the text Jim VK7JH MMedit |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1593 |
Hi how about this (s. manual): COLOUR fore [, back] or COLOR fore [, back] Sets the default colour for commands (PRINT, etc) that display on the on the VGA monitor. 'fore' is the foreground colour, 'back' is the background colour. The background is optional and if not specified will default to black. or this? TEXT x, y, string$ [,alignment$] [, font] [, scale] [, c] [, bc] Displays a string on the VGA monitor starting at 'x' and 'y'. ‘string$’ is the string to be displayed. Numeric data should be converted to a string and formatted using the Str$() function. ' alignment$' is a string expression or string variable consisting of 0, 1 or 2 letters where the first letter is the horizontal alignment around 'x' and can be L, C or R for LEFT, CENTER, RIGHT and the second letter is the vertical alignment around 'y' and can be T, M or B for TOP, MIDDLE, BOTTOM. The default alignment is left/top. A third letter can be used in the alignment string to indicate the rotation of the text. This can be 'N' for normal orientation, 'V' for vertical text with each character under the previous running from top to bottom, 'I' the text will be inverted (ie, upside down), 'U' the text will be rotated counter clockwise by 90º and 'D' the text will be rotated clockwise by 90º 'font' and 'scale' are optional and default to that set by the FONT command. 'c' is the drawing colour and 'bc' is the background colour. They are optional and default to the current foreground and background colours. See the chapter "Basic Drawing Commands" for a definition of the colours and graphics coordinates. ![]() causality ≠correlation ≠coincidence |
||||
frnno967 Senior Member ![]() Joined: 02/10/2020 Location: United StatesPosts: 104 |
That worked perfect, thanks! I'm trying to figure out how to change text color on the fly for the ANSI colors in the terminal program I'm working on. I guess text will have to be printed one character at a time so that the color can be changed? but this is a great start, much appreciated! Jay Crutti: Ham Radio Operator, K5JCJ. Computer Enthusiast. Musician. Engineer. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Whenever you receive the esc[ nnn m sequence you set the appropriate colour or attribute The sequence can have multiple nnn separated by semicolons, usually when you want to set foreground and background at the same time. Jim VK7JH MMedit |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |