Repository navigation
BREAKING CHANGES
- The
useLegacyparameter of theConsoleColoroverloads has been renamed touseWebColors. Code that passes it by name has to be updated; the colours it produces are unchanged. - An undefined
ConsoleColorvalue now throws anArgumentOutOfRangeExceptioninstead of aKeyNotFoundException.
Bug fixes
- Fixed a crash on .NET Framework when a color string ended with a reset escape sequence followed by a partial one, e.g.
"\x1b[0m\x1b[" NO_COLORis now only honored when it is non-empty, as the specification requires- The exception thrown for an invalid hexadecimal color value now names the parameter that callers actually pass (
hexColor) - A denied registry read while detecting a CI/CD environment no longer takes the library down with a
TypeInitializationException - The
DisableRuntimeMarshallingassembly attribute is now actually applied on .NET 8 and .NET 9; its build condition had silently never matched
Performance
Allocations are down for every overload except the nested case, which is unchanged. Measured on .NET 9 with both versions loaded into the same process:
| Method | 7.0.1 | 8.0.0 | |
|---|---|---|---|
Pastel(Color) |
120 B | 96 B | -20% |
Pastel(ConsoleColor) |
88 B | 64 B | -27% |
Pastel(hex) |
120 B | 96 B | -20% |
Pastel(Color), nested |
184 B | 184 B | — |
Throughput is a few percent better across the board, but the margin is close enough to the measurement noise that the allocation figures above are the meaningful ones.
General
- The
ConsoleColorcolour mapping is now documented as the combined CSS3 list, which is whyDarkGray(#A9A9A9) is deliberately lighter thanGray(#808080)