Open mattmccarty opened 6 years ago
colors.rb
src/colors.rb
You're a Ruby guy, huh? ;)
haha! I Just realized that I did that. I'm an 'everything' guy, so it gets hard to keep things straight sometimes. My fingers type faster than I think.
We should probably also include clearing the screen in this issue.
The exception (maybe) is for 3rd party console applications (i.e: Console2/ConsoleZ, ConEmu, Cygwin, MingW, etc). These applications have supported ANSI color codes forever. We will need to determine the console type. If the console is cmd.exe (the default Windows console) then we need to check the version of windows and act accordingly. I need to test this theory though.
@mcgoo's rebased implementation doesn't even try to detect alternative terminal emulators right now -- any suggestions on how to actually detect this?
Terminal detection is almost impossible in linux. I've tried. With windows I know we can detect cygwin, but we may not be able to detect the others. We need to find out. If we can't then we need to figure out an implementation that works across the board.
Lets just make sure ansi color support is working for Windows 10. Supporting non-ansi consoles looks like it will be a great deal of work, so that functionality should probably be implemented at a later time (if it's really needed).
My thoughts are to create an attr.rs file in sys/windows like unix has and implement the get_terminal_attr, set_terminal_attr, raw_terminal_attr. We can then enable ansi support through set_terminal_attr. This will keep it consistent with other operating systems.
@mattmccarty: This task might already be done, since styling and colors already works for other ANSI platforms. Is there any work actually left with this task?
The next thing we should implement is color support because it's the easiest and will provide atleast some functionality to WIndows users. Microsoft just updated their console to support ANSI codes, so we should provide a backup for people using a version of windows that doesn't support it (if the are using the default Windows console). Any version of Windows that is less than '10.0.10586' will need to return these backup color options.
The exception (maybe) is for 3rd party console applications (i.e: Console2/ConsoleZ, ConEmu, Cygwin, MingW, etc). These applications have supported ANSI color codes forever. We will need to determine the console type. If the console is cmd.exe (the default Windows console) then we need to check the version of windows and act accordingly. I need to test this theory though.
Here is an example of a couple of non-ansi standard enums that we could use:
My thoughts are to have a new colors.rsmodule in src/sys/windows and return the color spaces accordingly. This will require some reconfigurations of the src/colors.rsmodule either way.