Skip to content

Commit

Permalink
fix: fixes minor issues with pretty styles in different browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Stacy committed Sep 11, 2024
1 parent 7d11815 commit b0f4f0e
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CommonFormatter from './formatters/common';
import JsonFormatter from './formatters/json';
import PrettyFormatter from './formatters/pretty';
import StandardFormatter from './formatters/standard/standard';
import { isChrome, isSafari } from './functions';
import { isFirefox } from './functions';

/**
* All valid log terminators. These are the terminators that can be called to end a log chain.
Expand Down Expand Up @@ -155,9 +155,7 @@ export function getAlertConfig(overrides: Partial<LevelConfiguration> = {}): Lev
return {
levelName: 'alert',
level: 0,
style: `padding-right: ${
isChrome() ? '32' : '26'
}px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fc8585, #fc2323); color: #fff; border-color: #b70101;`,
style: `padding-right: 24px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fc8585, #fc2323); color: #fff; border-color: #b70101;`,
terminalStyle: ['white', 'bold', 'bgRed'],
method: 'error',
emoji: '🚨',
Expand All @@ -172,9 +170,7 @@ export function getErrorConfig(overrides: Partial<LevelConfiguration> = {}): Lev
return {
levelName: 'error',
level: 1,
style: `padding-right: ${
isChrome() ? '32' : '26'
}px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fff, #ffd1d1); color: #a4000f; border-color: #e3bbbb;`,
style: `padding-right: 24px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fff, #ffd1d1); color: #a4000f; border-color: #e3bbbb;`,
terminalStyle: ['white', 'bgRed'],
method: 'error',
emoji: '🔥',
Expand All @@ -189,9 +185,7 @@ export function getWarnConfig(overrides: Partial<LevelConfiguration> = {}): Leve
return {
levelName: 'warn',
level: 2,
style: `font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fff, #fff0a8); color: #715100; border-color: #e3d696; padding-right: ${
isChrome() ? '38' : '44'
}px;`,
style: `font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fff, #fff0a8); color: #715100; border-color: #e3d696; padding-right: ${isFirefox() ? '44px' : '30px'};`,
terminalStyle: ['white', 'bgYellow'],
method: 'warn',
emoji: '🔔',
Expand All @@ -206,9 +200,7 @@ export function getInfoConfig(overrides: Partial<LevelConfiguration> = {}): Leve
return {
levelName: 'info',
level: 3,
style: `padding-right: ${
isSafari() ? '49' : '52'
}px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #d8ebff, #b2d7ff); color: #465464; border-color: #96b5d7;`,
style: `padding-right: 44px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #d8ebff, #b2d7ff); color: #465464; border-color: #96b5d7;`,
terminalStyle: ['white', 'bgBlue'],
method: 'info',
emoji: 'ℹ️',
Expand All @@ -223,9 +215,7 @@ export function getFailConfig(overrides: Partial<LevelConfiguration> = {}): Leve
return {
levelName: 'fail',
level: 4,
style: `padding-right: ${
isChrome() ? '52' : '44'
}px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #ffe8e8, #ffd1d1); color: #a4000f; border-color: #e3bbbb;`,
style: `padding-right: 44px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #ffe8e8, #ffd1d1); color: #a4000f; border-color: #e3bbbb;`,
terminalStyle: ['white', 'bgRed'],
method: 'info',
emoji: '❌',
Expand All @@ -241,7 +231,7 @@ export function getSuccessConfig(overrides: Partial<LevelConfiguration> = {}): L
levelName: 'success',
level: 5,
style:
'font-size: 12px; border-radius: 4px; padding-right: 30px; background: linear-gradient(to right, #e6f6e4, #ceedc9); color: #4e594d; border-color: #b7d1b3;',
'font-size: 12px; border-radius: 4px; padding-right: 22px; background: linear-gradient(to right, #e6f6e4, #ceedc9); color: #4e594d; border-color: #b7d1b3;',
terminalStyle: ['white', 'bgGreen'],
method: 'info',
emoji: '🎉',
Expand All @@ -256,7 +246,7 @@ export function getLogConfig(overrides: Partial<LevelConfiguration> = {}): Level
return {
levelName: 'log',
level: 6,
style: `font-size: 12px; border-radius: 4px; padding-right: 60px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;`,
style: `font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;`,
terminalStyle: ['white', 'bgGray'],
method: 'log',
emoji: '🪵',
Expand All @@ -272,7 +262,7 @@ export function getDebugConfig(overrides: Partial<LevelConfiguration> = {}): Lev
levelName: 'debug',
level: 7,
style:
'font-size: 12px; padding-right: 44px; border-right: 1px solid #d9dce0; color: #465464; border-color: #999999;',
'font-size: 12px; padding-right: 36px; border-right: 1px solid #d9dce0; color: #465464; border-color: #999999;',
terminalStyle: ['white', 'bgBlack'],
method: 'debug',
emoji: '🐞',
Expand All @@ -287,7 +277,7 @@ export function getVerboseConfig(overrides: Partial<LevelConfiguration> = {}): L
return {
levelName: 'verbose',
level: 8,
style: 'font-size: 12px; padding-right: 31px; color: #999999;',
style: 'font-size: 12px; padding-right: 22px; color: #999999;',
terminalStyle: ['black', 'italic'],
method: 'debug',
emoji: '💬',
Expand Down

0 comments on commit b0f4f0e

Please sign in to comment.