Author Topic: Windows command shell colors  (Read 3232 times)


  • Sr. Member
  • ****
  • Posts: 476
Windows command shell colors
« on: July 16, 2020, 10:47:44 am »
I have just installed the textmode ODE fpc 3.2.0 on my fathers new machine, windows build 1903. Usually to run the IDE I open a command shell (cmd.exe) and start fp from there.

And normally cmd.exe opens a terminal window in lightgray on black, but on this machine it comes up in a bloody awful lightblue. I would not mind if not the IDE colors were also much too bright, and I can hardly see the syntax highlighting.

So I startet adjusting the terminal colors, and the IDE followed - somehow. I don't know how exactly... the IDE uses a lot of colors while the IDE only  distinguishes  back- and foreground for normal text and popup. In any case the IDE went more and more colorful and soon I had messed it up completely, it now shows text in blue on a blue window, only the frames and highlighted syntax appear in pink. And I can't revert it, tried changing terminal colors, changed to legacy console, reinstalled fp, rebooted, but am stuck with an unusable IDE just because of weird color settings stored somewhere in the windows vaults.

The only solution is to use the powershell instead, but there the IDE will regularly produce signal 291 during compilation. Or Lazarus, but I just still like the textmode IDE because it is so simple and lightning fast.

Has anyone experienced that before ? I set cmd.exe back to normal colors and it appers ok, just the IDE keeps using weird colors which make it unusable. Where are these stored ?

Correction: it is windows build 1909.


« Last Edit: July 16, 2020, 11:11:12 am by Nitorami »


  • Administrator
  • Hero Member
  • *
  • Posts: 11266
  • FPC developer.
Re: Windows command shell colors
« Reply #1 on: July 16, 2020, 11:36:34 am »
I had some similar problem last winter, and looked very long for it.

In the end, in the "terminal"  tab the "use separate foreground color" or something like was enabled, and so untick it.


  • Sr. Member
  • ****
  • Posts: 476
Re: Windows command shell colors
« Reply #2 on: July 16, 2020, 12:56:10 pm »
I had tried this"separate foregound" but it did nothing for me. This "terminal" option is new; when switching to legacy console, it does not exist, but the colors are still crap.

I spend two hours with that now and finally got it back working. The logic appears to be as follows:
Console applications such as the IDE may use 16 predefined colors. In good old DOS days, these were palettized; 0-7 being rather dark colors for use as background, 8-15 were brighter. Turbo pascal allowed to manually assign these 16 palette entries to the elements of the IDE, but in the FPC IDE it is fixed.

You can see the 16 colors in the color dialog of the cmd shell, in the small boxes. The IDE uses these colors, but they are no longer fixed, instead window allows you to set them them to millions of arbitrary RGB values. Why they appear to be set to different default values than before I have no idea.
But anyway, to adjust the IDE, you need to go though these 16 predefined colors and adjust their R,G and B values. This is rather tedious, as you need to find out for each IDE element which color entry it is allocated to. E.g. the background is No.1, the second box from the left.
When doing that, the shell itself will probably look awful, because its four colours for text, background, popup and popup background are based on the same 16 entries. Don't worry about that, just adjust the RGB values so that the IDE looks ok; in  the end, select four colors from the 16 for the cmd shell, but don't touch the RGB settings again.

Amendment: This explains why and how MS messed it up.

I have still not found an easy way to reset the color scheme to the old default. The article talks about a colortool which I can get from github ... need to built it from the source... it is certainly faster to re-adjust it all manually.
« Last Edit: July 16, 2020, 01:57:40 pm by Nitorami »


TinyPortal © 2005-2018