tslog icon indicating copy to clipboard operation
tslog copied to clipboard

Not a bug: Color pallet

Open minmur opened this issue 5 years ago • 6 comments

It's not a bug but some recommendations are needed. I'm using iTerm + Oh-My-Zsh with Powerlevel10k and can't get those nice colors you have in the screenshot any how.

Can you recommend what was used to get shiny and beautiful looking logs?

Here is what i see: image

minmur avatar Jun 19 '20 04:06 minmur

Hi, @minmur thanks for reaching out. In order to avoid unnecessary dependencies like chalk and further improve our performance, tslog only uses native colors available through Node.js util. Older versions <12 don't support the entire palette and fall-back to black and white.

I guess you are still running an older version and would suggest you to update to the current LTS (12.x) version or even 14.x which is going to become the next LTS in fall. Does it solve your issue? If it doesn't, I would kindly ask you to provide me with your Node.js and OS versions and re-open this issue. Thanks

cheers

Eugene

terehov avatar Jun 19 '20 09:06 terehov

My OS is macOS Catalina. Node version 12.5.0 (via nvm)

I have cleared all my terminal setting to factory level (at least i think so). And still didn't get "true" colors. Installed iTerm etc and still same. But for example nvm ls result has colors: image

minmur avatar Jun 21 '20 05:06 minmur

Thanks. I'll have a look at it.

terehov avatar Jun 21 '20 08:06 terehov

@minmur I checked it out and "Oh-My-Zsh" seems to be ignoring or overwriting our styles.

Both on iTerm:

Without "Oh-My-Zsh": image

With "Oh-My-Zsh": image

If you have some time, it would be amazing if you could have a look and try to fix it!

Thanks!

terehov avatar Jun 21 '20 09:06 terehov

Hi @terehov do you have a plan to support metaline color customization?

If I find the correct place, the metaline color is hard coded as gray.

if (concatenatedMetaLine.length > 0) {
      std.write(
        LoggerHelper.styleString(
          ["gray"],
          `[${concatenatedMetaLine}]`,
          this.settings.colorizePrettyLogs
        )
      );

My iterm2 background is gray, so I cannot see metaline. (I have to use colorizePrettyLogs: false)

herbertpan avatar Apr 24 '21 06:04 herbertpan

@herbertpan Makes sense. Thank you. I am going to add it to the V4 release too.

terehov avatar Aug 23 '22 19:08 terehov

Done. V4 beta allows you to template and overwrite all styles, event the meta line.

Have a look at these tests:

  • Styles: https://github.com/fullstack-build/tslog/blob/v4/tests/Nodejs/9_pretty_Styles.test.ts

  • Templates: https://github.com/fullstack-build/tslog/blob/v4/tests/Nodejs/7_pretty_Settings.test.ts#L127

Give it a go and let me know if that solves your problem:

  • npm i tslog@next

  • and run it with node --enable-source-maps or for TypeScript node --enable-source-maps --experimental-specifier-resolution=node --no-warnings --loader ts-node/esm

terehov avatar Sep 30 '22 14:09 terehov

V4 is released now, so I'm going to close this issue. Feel free to open a new one if V4 didn't solve it for you.

terehov avatar Nov 15 '22 18:11 terehov