Check if the output supports colors (fixes #244) #253
Conversation
Many thanks for picking this up, @michalt! The current colouring scheme (let's call it palette) is important for me as I routinely have to look for specific things in build progress info. That is why I think we could add a command line option to control the palette with settings like We could also allow users to override the default palette in Could you modify the PR to preserve the current defaults, but keeping the |
@snowleopard Sounds good. Let's keep this PR focused on fixing the I've updated the commit and changed |
Agreed, let's keep this PR focused on fixing the
Actually this is hard to read on my terminal. I think no single palette will work well for everyone, so we will need to think this through in a separate issue. Let's drop this change for now. More importantly, I have the following issues when trying on my usual Windows/MSYS2 set up:
|
My guess is that |
Right, the blue colour now makes sense -- I guess Shake forces it this way when using So, we do need to tweak the current |
You could also modify Shake to use ansi-terminal (currently it just uses ANSI escapes directly: ndmitchell/shake#49) |
This avoids using colors when the output is, e.g., redirected to a file. This requried a change to avoid passing the `--colour` flag to shake (so that hadrian is in charge of colors). Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
@michalt Sure, I understand your problem and we'll fix it. I just don't want to mix it into this PR. You can use whatever colours work for you locally as a temporary workaround, but we'll provide a nicer way to do that. I think making this into a Now, coming back to To sum up, I am fine to merge this, but most likely I will drop the magic/ugly hack soon. Let me know if you have any other suggestions. @Mathnerd314 Sure, fixing this in Shake would be great too, but we probably don't want to wait for the next Shake's release. |
@snowleopard Sounds good - let's merge this and then work on removing the hack and improving the colors. Wrt. |
@snowleopard I don't think you are going to be able to just rely on Shake to magically fix it for you. Shake isn't going to provide nice and clean ANSI functions for you, you'll have to do that yourself. |
I meant overriding |
That makes a lot of sense, overriding |
@Mathnerd314 @ndmitchell Thanks for clarifying, I will look into this! |
This avoids using colors when the output is, e.g., redirected to a
file. This requried a change to avoid passing the
--colour
flag toshake (so that hadrian is in charge of colors).
I've also made minor changes to the colors themselves, opting to use
the standard colors (not the bright/vivid ones, otherwise we risk that
for some configurations this will be less readable).
Finally, I've changed the color for
putBuild
- using whiteforeground color is problematic (this was not a problem before due to
passing the
--color
flag to shake that was forcing different color).Signed-off-by: Michal Terepeta michal.terepeta@gmail.com