IronLanguages / dlr

Dynamic Language Runtime
Apache License 2.0
374 stars 84 forks source link

Fix option ColorfulConsole #271

Closed BCSharp closed 1 year ago

BCSharp commented 1 year ago

Option -X ColorfulConsole was not working, for several reasons:

  1. The fag mask used to set colors was incorrect, resulting all colors be coerced to either white or black.
  2. The fallback color was white, which for white background always resulted in the text being invisible (macOS default console has white background).
  3. The background detection was working only on Windows, on Unix, the background color is unknown. So to make this option usable on Unix systems, I extended it with an optional parameter of value dark or light. To prevent proliferation of constructor parameters and the number of constructors of BasicConsole and SuperConsole, they both got a constructor that accepts ConsoleOptions and picks up the option it can understand.