Programming => Graphics and Multimedia => Graphics => Topic started by: anchar on September 17, 2019, 11:40:50 am
Title: how to restore default characteristics of terminal in fpc + crt program?
Post by: anchar on September 17, 2019, 11:40:50 am
Default terminal characteristics (on linux mint) are: black background and grey font. After launching fpc program with TextColor(Red) and TextBackground(White) and quit out of a program, terminal still has red font and white background. The goal is to find a solution wich will restore default characteristics (black background and grey font) of terminal. thanks for your attention.
Title: Re: how to restore default characteristics of terminal in fpc + crt program?
Post by: Handoko on September 17, 2019, 02:32:37 pm
Have you tried to run these right before exit the program:
TextColor(White); // or maybe Grey TextBackground(Black);
Title: Re: how to restore default characteristics of terminal in fpc + crt program?
Post by: anchar on September 17, 2019, 03:23:03 pm
you are right, but i would like to find a solution which take into account settings of user`s terminal (TextColor, for example, will be red or black and TextBackground will be blue or green)
Title: Re: how to restore default characteristics of terminal in fpc + crt program?
Post by: Handoko on September 17, 2019, 03:58:38 pm
My Ubuntu Mate Terminal has black text with white background.
As far as I know Linuxes are very flexible with terminal. Users can install any one she/he likes, and each terminal may has its own default color.
I haven't tried, but maybe this is what you need: https://www.freepascal.org/docs-html/rtl/crt/normvideo.html
Title: Re: how to restore default characteristics of terminal in fpc + crt program?
Post by: lucamar on September 17, 2019, 04:27:07 pm
In case it matters, I did a quick test: changing colors (twice, just in case) and then using NormVideo did (more or less) work in gnome-terminal.
"More or less" because some colors don't show right (most notably in the background, even if in Black..DarkGray), but that is irrelevant for this thread :)
Title: Re: how to restore default characteristics of terminal in fpc + crt program?
Post by: winni on September 17, 2019, 05:08:56 pm
Hi!
A Linux terminal is reset to his default values with
Title: Re: how to restore default characteristics of terminal in fpc + crt program?
Post by: anchar on September 18, 2019, 02:34:57 pm
the solution is not pretty nice, but worked (from here: https://wiki.freepascal.org/Executing_External_Programs#TProcess). you should paste the code to the relevant places in a program: