Repository navigation
How to set the screen's color to blue in raw mode? #752
|
I learned from https://viewsourcecode.org/snaptoken/kilo/ to write a simple text editor in circle in raw mode:
I like the qbasic IDE's blue background color which I used when I am a child:
is there some way to set my text editor's background color to blue like qbasic's ide? Thanks! |
Replies: 1 comment 1 reply
|
Hi @zsdz Yes. The screen in Circle understands the ANSI color codes. They are listed in doc/screen.txt. The trick is to set the colors before you clear. Clearing and scrolling fill with the current background color. So this paints the whole screen blue. const char *s = "\x1b[44m\x1b[37m\x1b[H\x1b[J";
mConsole.Write (s, strlen (s));A few differences from a full terminal matter for kilo. Each code has to be sent on its own.
There is no
|


Hi @zsdz
Yes. The screen in Circle understands the ANSI color codes. They are listed in doc/screen.txt.
\x1b[44msets the background to blue.\x1b[37mgives the light grey text that QBasic used.The trick is to set the colors before you clear. Clearing and scrolling fill with the current background color. So this paints the whole screen blue.
A few differences from a full terminal matter for kilo.
Each code has to be sent on its own.
\x1b[44;37mis ignored because themcommand only reads one number. Send\x1b[44m\x1b[37minstead.\x1b[2Jis ignored too. Use\x1b[H\x1b[Jto clear the screen. Kilo's\x1b[Kafte…