This seems to be a question with the XY-problem - it's not asking the right thing to get the desired solution:
Assume the output is colored, and the empty part of the screen is of different color or filled with a character.
Think about how you expect the output to look for these cases:
An empty line? Lines filled with only space characters? Lines with one space character only? With one tab? With one space and one tab? With one tab and one space?
Yes, they all look different!
Or do you want an empty line look like - just an empty line?
If that's the case, you do not want to color the output streams, really, and this answer applies.
I'll give a similar approach to the solution of @StéphaneChazelas, but "inverse":
You can, technically, color STDOUT and STDERR, line by line, with adding the right color escape codes to start and end of line on both streams.
You would need to take care to reset color at least each line, because otherwise any program using color, like ls
, would mess up your terminal.
You just have not much control over the output color - so it's hard to get right at best.
But: You have control over all other colors used, right?
And you need only one color in this case? Great!
Set the terminals default color to the STDOUT/STDERR color, and color the rest like you prefer.
You can color you shell prompt - and use the prompt code to color other parts also.
Admittedly, it's somewhat tricky to color the command line, where you edit your command, but it's possible certainly.
But don't try that with bash
if you can use zsh
, as the prompt handling code it much more flexible there - that's what you'll need.
Now, set your terminals default foreground color to gray, and possibly background - but try to leave that as transparent/undefined.
To set the background color of the command line, look at this example from
Change the background color of command line in zsh when I change the prompt theme:
PROMPT="%{$bg[cyan]%}%{$fg[red]%}%n%{$reset_color%}%{$bg[cyan]%}@%{$fg[red]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%{$bg[cyan]%}%% "

(The hard part is getting the unused end sections of lins in various situations right.)