Skip to content

what changed in v3? / changelog? #37

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

Open
ljharb opened this issue Sep 13, 2024 · 6 comments
Open

what changed in v3? / changelog? #37

ljharb opened this issue Sep 13, 2024 · 6 comments

Comments

@ljharb
Copy link

ljharb commented Sep 13, 2024

I can't tell what the breaking changes are in v3, and there's no changelog. Can you help me understand how I can safely upgrade?

@joeattardi
Copy link
Owner

Hey there, sorry for not including a changelog. Mea culpa.

Here is an overview of what changes for v3.

  • When setting custom colors, token type names are now PascalCase instead of SCREAMING_CASE.
  • When specifying the colors, instead of using a string for the color function, you need to import the color object exported by the library. This contains named functions for each main color (this change was because I changed the underlying color library used).
  • The pretty option has been replaced with an indent option. By default the library pretty prints the JSON with indentation of 2 spaces. If you don't want pretty printing, you can set indent to 0.

Other than that the core usage of the library is the same. You can pass an object or a JSON string to the colorize function.

I hope this helps, and my apologies for the confusion.

@ljharb
Copy link
Author

ljharb commented Sep 16, 2024

Thanks! I’ll try to migrate and see how it goes.

Does indent also take a tab character?

@joeattardi
Copy link
Owner

No, just a number of spaces. It just passes that option through as the third argument to JSON.stringify.

@ljharb
Copy link
Author

ljharb commented Sep 16, 2024

JSON.stringify takes a string also, so that tabs can be used.

@joeattardi
Copy link
Owner

Really? I never knew that!

@ljharb
Copy link
Author

ljharb commented Sep 16, 2024

Looks like another change is that the module.exports value is no longer the colorize function itself, so i need to .colorize to get at the function.

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

No branches or pull requests

2 participants