table icon indicating copy to clipboard operation
table copied to clipboard

Support for Colors on Windows

Open zigazajc007 opened this issue 2 years ago • 1 comments

Hello,

Table works great on Windows, only problem is that color codes are implemented from Linux. So only thing that is needed is to check what OS are you using, and if Windows, you would use different color codes.

zigazajc007 avatar May 21 '22 13:05 zigazajc007

Actually Windows is supported pretty well, if you use an stdout wrapper like color.Output ( from https://github.com/fatih/color ) or colorable.NewColorableStdout() from https://github.com/mattn/go-colorable You just pass them like table.New(color.Output) or table.New(colorable.NewColorableStdout()) and both can detect the OS and do the appropriate windows magic. In my experience, the former works slightly better.

mmetc avatar Oct 16 '22 20:10 mmetc