Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix color on Windows #635

Closed
wants to merge 1 commit into from
Closed

fix color on Windows #635

wants to merge 1 commit into from

Conversation

nichady
Copy link
Contributor

@nichady nichady commented Dec 20, 2021

fixes #343

Here's a before and after for one of my Taskfile projects

before fix:
image

after:
image

@viktorasm
Copy link

Having no option to turn off colors permanently (nobody wants to re-type env variable) is a big issue for windows users. Please get this merged:)

@jcrben
Copy link

jcrben commented Aug 28, 2022

@ghostsquad @andreynering thoughts? I had thought this might have something to do with microsoft/terminal#6634 since I noticed it using the Microsoft Terminal but not sure about that

@ghostsquad
Copy link
Contributor

@jcrben I see no harm in this honestly. How do we test this behavior?

@VictorYap-at-Symend
Copy link

@jcrben @ghostsquad

  1. Use Windows, having "go (language)" installed.
  2. Use Visual Studio Code and its terminal(s) - git-bash (recommended), cmd.exe (untested), powershell (untested).
  3. Checkout and install some stable branch/tag of "go-task"
    • if you tweak the "version" variable and do task.exe --version, that could help you be more confidence that you're using a custom build.
  4. Using that freshly created task.exe binary to run some Taskfile for some dummy project/solution that somehow outputs colours. Note that it's mangled (see initial screenshot).
  5. Cherry-pick @nichady's commit atop the currently checked-out branch/tag.
  6. Rebuild the binary and install it
    • if you tweak the "version" variable and do task.exe --version, that could help you be more confidence that you're using a custom build.
  7. Re-run the Taskfile and the result should be colourized output instead of mangled colour codes.

(optionally) Re-install "go-task" to get back to an official release, if you like.

I've been happy with the results atop 3.3.0 and some other relatively recent "latest tag" too (probably 3.14.1).

@andreynering
Copy link
Member

andreynering commented Aug 29, 2022

Sorry for taking so long to review this.

I'm not sure what is happening on Windows, but the change in this PR is is certainly not the right way to implement this, sorry. It would have side-effect and cause other bugs.

I think the problem may be related to "reset" being used for white here (but I'm not sure, we need to debug that):

return color.New(envColor("TASK_COLOR_RESET", color.Reset)).FprintfFunc()

@andreynering
Copy link
Member

I have a secondary Windows machine to debug this, just need to find the time...

@pd93
Copy link
Member

pd93 commented Jun 27, 2023

Closing this. See comment.

@pd93 pd93 closed this Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v3: color output doesn't work properly on Windows
7 participants