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

Upgrading to 2.0.0 #70

Closed
jorgebucaran opened this issue Sep 17, 2021 · 1 comment
Closed

Upgrading to 2.0.0 #70

jorgebucaran opened this issue Sep 17, 2021 · 1 comment
Labels
docs Docs and not so docs

Comments

@jorgebucaran
Copy link
Owner

jorgebucaran commented Sep 17, 2021

If you're upgrading from 1.x:

  • Colorette continues to work as-is. No need to do anything.
  • To override color-detection, there's a new createColors(options) that returns an object with all the available color functions. Terminal support is auto-detected, override it via options.useColor.
  • options.enabled has been removed in favor of createColors(options).
  • There's a new isColorSupported constant export.
    • true if the terminal supports color, false otherwise.

If you were previously using options.enabled and wish to override automatic color detection, use createColors().

import { createColors } from "colorette"
 ...
const { blue } = createColors({ useColor: myOptions.enabled })

console.log(blue("I'm blue"))
@kibertoad
Copy link
Collaborator

@jorgebucaran What's the rationale behind default colouring functions being enabled by default, rather than relying on auto-detect by default, btw?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Docs and not so docs
Projects
None yet
Development

No branches or pull requests

2 participants