jetzig-framework / jetzig

Jetzig is a web framework written in Zig
MIT License
308 stars 15 forks source link

Support Coloring on Windows #52

Open Deecellar opened 2 months ago

Deecellar commented 2 months ago

Given #51 I add this as an enchancement

rhues commented 3 weeks ago

When running Windows PowerShell, I get colorized log output:

jetzig ticket 52

I also tried the basic Windows terminal and got colorized log output.

@Deecellar, in what case is color not working for you? Perhaps a different terminal? I do have a solution that uses standard Windows colors rather than the ANSI colors currently used, but I can't submit a PR until I can reproduce the issue and prove the fix works.

rhues commented 3 weeks ago

For reference, there is code in the Zig standard library that may help with all the colorization issues. In the Zig repo, see lib/std/fs/File.zig and search for the term "ANSI". But even without ANSI support, we can still make it work the Windows way.

There are instructions here for enabling ANSI colors on Windows by default. Just set the registry key mentioned and Jetzig colors should work without any code updates. https://superuser.com/questions/413073/windows-console-with-ansi-colors-handling