Skip to content

Orange color display problem #5

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

Closed
uraz opened this issue Aug 31, 2018 · 4 comments · Fixed by #10
Closed

Orange color display problem #5

uraz opened this issue Aug 31, 2018 · 4 comments · Fixed by #10

Comments

@uraz
Copy link

uraz commented Aug 31, 2018

It seems that orange color used for "warn" level label is not working correctly. {orange-fg} is showing instead of a proper color.

image

@techieshark
Copy link
Contributor

I'm seeing the same thing.

@techieshark
Copy link
Contributor

techieshark commented Sep 13, 2018

@uraz You can fix this by using an RGB value for orange in const levelColors = ... in utils.js (see here).

(Colors seem to be defined here, and it doesn't look like orange exists.)

For instance, using #FFA500:

change

const levelColors = {
  debug: s => `{cyan-fg}${s}{/cyan-fg}`,
  info: s => `{#ffff94-fg}{bold}${s}{/bold}{/#ffff94-fg}`,
  warn: s => `{orange-fg}${s}{/orange-fg}`,
  error: s => `{red-fg}${s}{/red-fg}`,

to

const levelColors = {
  debug: s => `{cyan-fg}${s}{/cyan-fg}`,
  info: s => `{#ffff94-fg}{bold}${s}{/bold}{/#ffff94-fg}`,
  warn: s => `{#ffa500-fg}${s}{/#ffa500-fg}`,
  error: s => `{red-fg}${s}{/red-fg}`,

To give the following:

image

Or if you wanted to mimic the colors used by Google Cloud's Stackdriver logging console:

image

You could use:

const levelColors = {
  debug: s => `{blue-fg}${s}{/blue-fg}`,
  info: s => `{#7FDBFF-fg}${s}{/#7FDBFF-fg}`,
  warn: s => `{#DA7732-fg}${s}{/#DA7732-fg}`,
  error: s => `{#C2513F-fg}${s}{/#C2513F-fg}`,
};

to give:
image

In case it helps, here's my test.json file, and I'm using iTerm on Mac:

{ "timestamp": "2018-09-12T05:41:37.562Z", "level": "debug", "message": "message 1", "data": "some data", "another": { "any": "thing" }}
{ "timestamp": "2018-09-12T05:41:36.566Z", "level": "info", "message": "message 2", "data": "some other data" }
{ "timestamp": "2018-09-12T05:41:35.571Z", "level": "warn", "message": "message 3" }
{ "timestamp": "2018-09-12T05:41:35.571Z", "level": "error", "message": "message 4" }
{ "timestamp": "2018-09-12T05:41:35.571Z", "level": "error", "message": "message 5" }

techieshark added a commit to techieshark/json-log-viewer that referenced this issue Sep 13, 2018
Why:
* fixes gistia#5

What:
* Blessed doesn't appear to have an orange named color, so we use RGB
techieshark added a commit to techieshark/json-log-viewer that referenced this issue Sep 13, 2018
Why:
* fixes gistia#5

What:
* Blessed doesn't appear to have an orange named color, so we use RGB
vinioliveira pushed a commit that referenced this issue Sep 21, 2018
Why:
* fixes #5

What:
* Blessed doesn't appear to have an orange named color, so we use RGB
top-5 pushed a commit to top-5/json-log-viewer that referenced this issue Nov 22, 2018
Why:
* fixes gistia#5

What:
* Blessed doesn't appear to have an orange named color, so we use RGB
@Defkil
Copy link

Defkil commented Aug 5, 2020

Hey, on npm is still the old version with {orange-fg}warn{/orange-fg}

@cube-dan
Copy link

cube-dan commented Mar 9, 2023

Same problem here @Defkil (on a fresh install from today). I'm using patch-package as a stopgap. Patch attached: json-log-viewer+0.1.2.patch

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 a pull request may close this issue.

4 participants