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

feat(cli/console): inspect with colors regardless of Deno.noColor #7778

Merged
merged 4 commits into from
Oct 14, 2020
Merged

feat(cli/console): inspect with colors regardless of Deno.noColor #7778

merged 4 commits into from
Oct 14, 2020

Conversation

TTtie
Copy link
Contributor

@TTtie TTtie commented Oct 1, 2020

This PR adds the ability for users to inspect items stylized with ANSI colors regardless of the value of Deno.noColor - for example,

// Assumes that Deno.noColor is "true"
// Old behavior
Deno.inspect({ that: "is a object" }, { colors: true }) // { that: "is a object" }

// New behavior
Deno.inspect({ that: "is a object" }, { colors: true }) // { that: \x1b[32m"is a object"\x1b[39m }

Considerations:

  • Until Deno.noColor gets initted, should we assume the user accepts colors in their terminal?
    (currently as it is, colors.maybeColor assumes that terminal colors shouldn't be present)

Copy link
Collaborator

@nayeemrmn nayeemrmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favour of this change. It matches Node. Only APIs that write to the terminal should take into account NO_COLOR, not programmatic ones. We should consider it for std/fmt/colors.ts.

cli/rt/01_colors.js Show resolved Hide resolved
cli/rt/02_console.js Outdated Show resolved Hide resolved
cli/rt/40_testing.js Outdated Show resolved Hide resolved
@TTtie TTtie changed the title feat(cli/console): inspect with colors regardless of Deno.noColor [WIP] feat(cli/console): inspect with colors regardless of Deno.noColor Oct 1, 2020
@TTtie TTtie changed the title [WIP] feat(cli/console): inspect with colors regardless of Deno.noColor feat(cli/console): inspect with colors regardless of Deno.noColor Oct 2, 2020
@bartlomieju bartlomieju added this to the 1.5.0 milestone Oct 4, 2020
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

None yet

3 participants