Console.log CSS should support initial (or unset/revert) #13638
Labels
ext/console
Related to the ext/console crate
suggestion
suggestions for new features (yet to be agreed)
web
related to Web APIs
When pretty-printing output, it's common to apply a style for a span, before reverting back to the terminal's default style. This is used in terminal prompts and in log output, for example.
As a specific motivating example, consider this output (this program does not output color to non-tty stdouts).
With color, it looks like this:
But what if we want to use background-color instead?
In this case, I simply forgot to change the
color: white
used as resets tobackground-color: black
. That's an easy fix, but it shows the limitations of the current level of support. Furthermore, this color reset is fragile. What if the user uses a green terminal background?This breaks in an ugly way.
A quick test reveals that support exists in Firefox:
Thus, implementing at least one of
initial
/unset
/revert
is needed to make it easier to write good programs with well-formatted console output, in addition to improving parity with web platforms.The text was updated successfully, but these errors were encountered: