colorino 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -15
- package/dist/browser.bundle.cjs +3 -21
- package/dist/browser.bundle.mjs +3 -21
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.mjs +1 -1
- package/dist/shared/{colorino.D9xuyiJg.cjs → colorino.BgxwS1Lc.cjs} +3 -21
- package/dist/shared/{colorino.BPD_4Zhq.mjs → colorino.ClDpLv-k.mjs} +3 -21
- package/dist/shared/{colorino.bX_hrCT6.d.ts → colorino.Dh_05jaQ.d.cts} +1 -1
- package/dist/shared/{colorino.bX_hrCT6.d.cts → colorino.Dh_05jaQ.d.mts} +1 -1
- package/dist/shared/{colorino.bX_hrCT6.d.mts → colorino.Dh_05jaQ.d.ts} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Colorino automatically adapts its palette to your terminal or browser DevTools theme, and degrades colors gracefully so your logs stay readable and on‑brand even in limited environments
|
|
6
6
|
|
|
7
|
+

|
|
8
|
+
|
|
7
9
|
# <a id="0"></a><a id="0"></a>
|
|
8
10
|
|
|
9
11
|
- [Why use Colorino?](#1)
|
|
@@ -38,7 +40,7 @@ Colorino is different: it’s a "batteries-included" logging facade with beautif
|
|
|
38
40
|
|
|
39
41
|
## <a id="2"></a>Features
|
|
40
42
|
|
|
41
|
-
- 🎨 **Smart Theming:** Automatically detects *dark/light* mode and applies a
|
|
43
|
+
- 🎨 **Smart Theming:** Automatically detects *dark/light* mode and applies a high‑contrast base palette by default (Dracula for dark, GitHub Light for light); opt into a coordinated theme preset when you want richer colors.
|
|
42
44
|
- 🤘 **Graceful Color Degradation**: Accepts rich colors (hex/RGB) and automatically down‑samples to the best ANSI‑16/ANSI‑256/Truecolor match for the current environment.
|
|
43
45
|
- 🤝 **Familiar API:** If you know `console.log`, you already know Colorino: all standard log levels are supported.
|
|
44
46
|
- 🔀 **Environment-Aware:** Works in **Node.js** (ANSI color and truecolor) and all major **Browsers** (CSS styles).
|
|
@@ -150,17 +152,17 @@ Pass any of these names to the `theme` option to use a specific palette:
|
|
|
150
152
|
|
|
151
153
|
| Theme Name | Type | Description |
|
|
152
154
|
|----------------------|-----------------|--------------------------------------------------|
|
|
153
|
-
| `'dracula'` | **Dark** (High) | Vibrant pinks, purples, and cyans. |
|
|
154
|
-
| `'catppuccin-mocha'` | **Dark** (Low) | Soothing pastel colors. |
|
|
155
|
-
| `'
|
|
156
|
-
| `'
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
| `'dracula'` | **Dark** (High Contrast) | Vibrant pinks, purples, and cyans. |
|
|
156
|
+
| `'catppuccin-mocha'` | **Dark** (Low Contrast) | Soothing pastel colors. |
|
|
157
|
+
| `'github-light'` | **Light** (High Contrast)| Clean, sharp, high-contrast. |
|
|
158
|
+
| `'catppuccin-latte'` | **Light** (Low Contrast) | Warm, cozy light mode with soft colors. |
|
|
159
|
+
|
|
160
|
+
In auto mode, Colorino uses dracula in dark environments and github-light in light environments.
|
|
159
161
|
|
|
160
162
|
#### <a id="5-3-2"></a>Examples
|
|
161
163
|
|
|
162
|
-
**1.
|
|
163
|
-
Set only the colors you care about; everything else
|
|
164
|
+
**1. Default palette with custom branding:**
|
|
165
|
+
Set only the colors you care about; everything else uses the detected base theme or your explicitly selected theme.
|
|
164
166
|
|
|
165
167
|
```typescript
|
|
166
168
|
// Only customize error and warn
|
|
@@ -169,15 +171,21 @@ const myLogger = createColorino({
|
|
|
169
171
|
warn: '#ffa500'
|
|
170
172
|
})
|
|
171
173
|
|
|
172
|
-
// Detected dark terminal:
|
|
174
|
+
// Detected dark terminal (uses dracula as base):
|
|
173
175
|
// - error: #ff007b (your custom red)
|
|
174
176
|
// - warn: #ffa500 (your custom orange)
|
|
175
|
-
// - info
|
|
177
|
+
// - info: #8be9fd (dracula cyan)
|
|
178
|
+
// - log: #f8f8f2 (dracula foreground)
|
|
179
|
+
// - debug: #bd93f9 (dracula purple)
|
|
180
|
+
// - trace: #6272a4 (dracula comment)
|
|
176
181
|
|
|
177
|
-
// Detected light terminal:
|
|
182
|
+
// Detected light terminal (uses github-light as base):
|
|
178
183
|
// - error: #ff007b (your custom red)
|
|
179
184
|
// - warn: #ffa500 (your custom orange)
|
|
180
|
-
// - info
|
|
185
|
+
// - info: #0366d6 (github blue)
|
|
186
|
+
// - log: #24292e (github text)
|
|
187
|
+
// - debug: #586069 (github gray)
|
|
188
|
+
// - trace: #6a737d (github gray-light)
|
|
181
189
|
```
|
|
182
190
|
|
|
183
191
|
**2. Use a specific preset:**
|
|
@@ -200,10 +208,10 @@ const myLogger = createColorino(
|
|
|
200
208
|
```
|
|
201
209
|
|
|
202
210
|
**4. Force a specific mode (uses defaults):**
|
|
203
|
-
Useful for
|
|
211
|
+
Useful for environments where detection fails.
|
|
204
212
|
|
|
205
213
|
```typescript
|
|
206
|
-
// Forces dark mode using the default
|
|
214
|
+
// Forces dark mode using the default palette
|
|
207
215
|
const darkLogger = createColorino({}, { theme: 'dark' })
|
|
208
216
|
```
|
|
209
217
|
|
package/dist/browser.bundle.cjs
CHANGED
|
@@ -119,33 +119,15 @@ const githubLightPalette = {
|
|
|
119
119
|
trace: "#6a737d"
|
|
120
120
|
// Gray-light
|
|
121
121
|
};
|
|
122
|
-
const minimalDarkPalette = {
|
|
123
|
-
log: "#ffffff",
|
|
124
|
-
info: "#ffffff",
|
|
125
|
-
warn: "#ffffff",
|
|
126
|
-
error: "#ffffff",
|
|
127
|
-
debug: "#ffffff",
|
|
128
|
-
trace: "#ffffff"
|
|
129
|
-
};
|
|
130
|
-
const minimalLightPalette = {
|
|
131
|
-
log: "#000000",
|
|
132
|
-
info: "#000000",
|
|
133
|
-
warn: "#000000",
|
|
134
|
-
error: "#000000",
|
|
135
|
-
debug: "#000000",
|
|
136
|
-
trace: "#000000"
|
|
137
|
-
};
|
|
138
122
|
|
|
139
123
|
const themePalettes = {
|
|
140
124
|
"catppuccin-mocha": catppuccinMochaPalette,
|
|
141
125
|
"catppuccin-latte": catppuccinLattePalette,
|
|
142
126
|
dracula: draculaPalette,
|
|
143
|
-
"github-light": githubLightPalette
|
|
144
|
-
"minimal-dark": minimalDarkPalette,
|
|
145
|
-
"minimal-light": minimalLightPalette
|
|
127
|
+
"github-light": githubLightPalette
|
|
146
128
|
};
|
|
147
|
-
const defaultDarkTheme = "
|
|
148
|
-
const defaultLightTheme = "
|
|
129
|
+
const defaultDarkTheme = "dracula";
|
|
130
|
+
const defaultLightTheme = "github-light";
|
|
149
131
|
function isThemeName(theme) {
|
|
150
132
|
return theme in themePalettes;
|
|
151
133
|
}
|
package/dist/browser.bundle.mjs
CHANGED
|
@@ -117,33 +117,15 @@ const githubLightPalette = {
|
|
|
117
117
|
trace: "#6a737d"
|
|
118
118
|
// Gray-light
|
|
119
119
|
};
|
|
120
|
-
const minimalDarkPalette = {
|
|
121
|
-
log: "#ffffff",
|
|
122
|
-
info: "#ffffff",
|
|
123
|
-
warn: "#ffffff",
|
|
124
|
-
error: "#ffffff",
|
|
125
|
-
debug: "#ffffff",
|
|
126
|
-
trace: "#ffffff"
|
|
127
|
-
};
|
|
128
|
-
const minimalLightPalette = {
|
|
129
|
-
log: "#000000",
|
|
130
|
-
info: "#000000",
|
|
131
|
-
warn: "#000000",
|
|
132
|
-
error: "#000000",
|
|
133
|
-
debug: "#000000",
|
|
134
|
-
trace: "#000000"
|
|
135
|
-
};
|
|
136
120
|
|
|
137
121
|
const themePalettes = {
|
|
138
122
|
"catppuccin-mocha": catppuccinMochaPalette,
|
|
139
123
|
"catppuccin-latte": catppuccinLattePalette,
|
|
140
124
|
dracula: draculaPalette,
|
|
141
|
-
"github-light": githubLightPalette
|
|
142
|
-
"minimal-dark": minimalDarkPalette,
|
|
143
|
-
"minimal-light": minimalLightPalette
|
|
125
|
+
"github-light": githubLightPalette
|
|
144
126
|
};
|
|
145
|
-
const defaultDarkTheme = "
|
|
146
|
-
const defaultLightTheme = "
|
|
127
|
+
const defaultDarkTheme = "dracula";
|
|
128
|
+
const defaultLightTheme = "github-light";
|
|
147
129
|
function isThemeName(theme) {
|
|
148
130
|
return theme in themePalettes;
|
|
149
131
|
}
|
package/dist/browser.cjs
CHANGED
package/dist/browser.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
2
|
-
export { L as LogLevel } from './shared/colorino.
|
|
1
|
+
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.Dh_05jaQ.cjs';
|
|
2
|
+
export { L as LogLevel } from './shared/colorino.Dh_05jaQ.cjs';
|
|
3
3
|
|
|
4
4
|
declare const themePalettes: Record<ThemeName, Palette>;
|
|
5
5
|
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
2
|
-
export { L as LogLevel } from './shared/colorino.
|
|
1
|
+
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.Dh_05jaQ.mjs';
|
|
2
|
+
export { L as LogLevel } from './shared/colorino.Dh_05jaQ.mjs';
|
|
3
3
|
|
|
4
4
|
declare const themePalettes: Record<ThemeName, Palette>;
|
|
5
5
|
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
2
|
-
export { L as LogLevel } from './shared/colorino.
|
|
1
|
+
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.Dh_05jaQ.js';
|
|
2
|
+
export { L as LogLevel } from './shared/colorino.Dh_05jaQ.js';
|
|
3
3
|
|
|
4
4
|
declare const themePalettes: Record<ThemeName, Palette>;
|
|
5
5
|
|
package/dist/browser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ColorLevel, t as themePalettes, M as MyColorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.
|
|
1
|
+
import { C as ColorLevel, t as themePalettes, M as MyColorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.ClDpLv-k.mjs';
|
|
2
2
|
|
|
3
3
|
class BrowserColorSupportDetector {
|
|
4
4
|
constructor(_window, _navigator, _overrideTheme) {
|
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const inputValidator = require('./shared/colorino.
|
|
3
|
+
const inputValidator = require('./shared/colorino.BgxwS1Lc.cjs');
|
|
4
4
|
const node_child_process = require('node:child_process');
|
|
5
5
|
const node_url = require('node:url');
|
|
6
6
|
const node_path = require('node:path');
|
package/dist/node.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
1
|
+
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.Dh_05jaQ.cjs';
|
|
2
2
|
|
|
3
3
|
declare function createColorino(userPalette?: Partial<Palette>, options?: ColorinoOptions): Colorino;
|
|
4
4
|
|
package/dist/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
1
|
+
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.Dh_05jaQ.mjs';
|
|
2
2
|
|
|
3
3
|
declare function createColorino(userPalette?: Partial<Palette>, options?: ColorinoOptions): Colorino;
|
|
4
4
|
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
1
|
+
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.Dh_05jaQ.js';
|
|
2
2
|
|
|
3
3
|
declare function createColorino(userPalette?: Partial<Palette>, options?: ColorinoOptions): Colorino;
|
|
4
4
|
|
package/dist/node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ColorLevel, t as themePalettes, M as MyColorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.
|
|
1
|
+
import { C as ColorLevel, t as themePalettes, M as MyColorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.ClDpLv-k.mjs';
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
@@ -119,33 +119,15 @@ const githubLightPalette = {
|
|
|
119
119
|
trace: "#6a737d"
|
|
120
120
|
// Gray-light
|
|
121
121
|
};
|
|
122
|
-
const minimalDarkPalette = {
|
|
123
|
-
log: "#ffffff",
|
|
124
|
-
info: "#ffffff",
|
|
125
|
-
warn: "#ffffff",
|
|
126
|
-
error: "#ffffff",
|
|
127
|
-
debug: "#ffffff",
|
|
128
|
-
trace: "#ffffff"
|
|
129
|
-
};
|
|
130
|
-
const minimalLightPalette = {
|
|
131
|
-
log: "#000000",
|
|
132
|
-
info: "#000000",
|
|
133
|
-
warn: "#000000",
|
|
134
|
-
error: "#000000",
|
|
135
|
-
debug: "#000000",
|
|
136
|
-
trace: "#000000"
|
|
137
|
-
};
|
|
138
122
|
|
|
139
123
|
const themePalettes = {
|
|
140
124
|
"catppuccin-mocha": catppuccinMochaPalette,
|
|
141
125
|
"catppuccin-latte": catppuccinLattePalette,
|
|
142
126
|
dracula: draculaPalette,
|
|
143
|
-
"github-light": githubLightPalette
|
|
144
|
-
"minimal-dark": minimalDarkPalette,
|
|
145
|
-
"minimal-light": minimalLightPalette
|
|
127
|
+
"github-light": githubLightPalette
|
|
146
128
|
};
|
|
147
|
-
const defaultDarkTheme = "
|
|
148
|
-
const defaultLightTheme = "
|
|
129
|
+
const defaultDarkTheme = "dracula";
|
|
130
|
+
const defaultLightTheme = "github-light";
|
|
149
131
|
function isThemeName(theme) {
|
|
150
132
|
return theme in themePalettes;
|
|
151
133
|
}
|
|
@@ -117,33 +117,15 @@ const githubLightPalette = {
|
|
|
117
117
|
trace: "#6a737d"
|
|
118
118
|
// Gray-light
|
|
119
119
|
};
|
|
120
|
-
const minimalDarkPalette = {
|
|
121
|
-
log: "#ffffff",
|
|
122
|
-
info: "#ffffff",
|
|
123
|
-
warn: "#ffffff",
|
|
124
|
-
error: "#ffffff",
|
|
125
|
-
debug: "#ffffff",
|
|
126
|
-
trace: "#ffffff"
|
|
127
|
-
};
|
|
128
|
-
const minimalLightPalette = {
|
|
129
|
-
log: "#000000",
|
|
130
|
-
info: "#000000",
|
|
131
|
-
warn: "#000000",
|
|
132
|
-
error: "#000000",
|
|
133
|
-
debug: "#000000",
|
|
134
|
-
trace: "#000000"
|
|
135
|
-
};
|
|
136
120
|
|
|
137
121
|
const themePalettes = {
|
|
138
122
|
"catppuccin-mocha": catppuccinMochaPalette,
|
|
139
123
|
"catppuccin-latte": catppuccinLattePalette,
|
|
140
124
|
dracula: draculaPalette,
|
|
141
|
-
"github-light": githubLightPalette
|
|
142
|
-
"minimal-dark": minimalDarkPalette,
|
|
143
|
-
"minimal-light": minimalLightPalette
|
|
125
|
+
"github-light": githubLightPalette
|
|
144
126
|
};
|
|
145
|
-
const defaultDarkTheme = "
|
|
146
|
-
const defaultLightTheme = "
|
|
127
|
+
const defaultDarkTheme = "dracula";
|
|
128
|
+
const defaultLightTheme = "github-light";
|
|
147
129
|
function isThemeName(theme) {
|
|
148
130
|
return theme in themePalettes;
|
|
149
131
|
}
|
|
@@ -2,7 +2,7 @@ type ConsoleMethod = 'log' | 'info' | 'warn' | 'error' | 'trace' | 'debug';
|
|
|
2
2
|
type LogLevel = ConsoleMethod & string;
|
|
3
3
|
type Palette = Record<LogLevel, string>;
|
|
4
4
|
type TerminalTheme = 'dark' | 'light' | 'unknown';
|
|
5
|
-
type ThemeName = 'catppuccin-mocha' | 'catppuccin-latte' | 'dracula' | 'github-light'
|
|
5
|
+
type ThemeName = 'catppuccin-mocha' | 'catppuccin-latte' | 'dracula' | 'github-light';
|
|
6
6
|
interface ColorinoOptions {
|
|
7
7
|
disableWarnings?: boolean;
|
|
8
8
|
theme?: TerminalTheme | ThemeName | 'auto';
|
|
@@ -2,7 +2,7 @@ type ConsoleMethod = 'log' | 'info' | 'warn' | 'error' | 'trace' | 'debug';
|
|
|
2
2
|
type LogLevel = ConsoleMethod & string;
|
|
3
3
|
type Palette = Record<LogLevel, string>;
|
|
4
4
|
type TerminalTheme = 'dark' | 'light' | 'unknown';
|
|
5
|
-
type ThemeName = 'catppuccin-mocha' | 'catppuccin-latte' | 'dracula' | 'github-light'
|
|
5
|
+
type ThemeName = 'catppuccin-mocha' | 'catppuccin-latte' | 'dracula' | 'github-light';
|
|
6
6
|
interface ColorinoOptions {
|
|
7
7
|
disableWarnings?: boolean;
|
|
8
8
|
theme?: TerminalTheme | ThemeName | 'auto';
|
|
@@ -2,7 +2,7 @@ type ConsoleMethod = 'log' | 'info' | 'warn' | 'error' | 'trace' | 'debug';
|
|
|
2
2
|
type LogLevel = ConsoleMethod & string;
|
|
3
3
|
type Palette = Record<LogLevel, string>;
|
|
4
4
|
type TerminalTheme = 'dark' | 'light' | 'unknown';
|
|
5
|
-
type ThemeName = 'catppuccin-mocha' | 'catppuccin-latte' | 'dracula' | 'github-light'
|
|
5
|
+
type ThemeName = 'catppuccin-mocha' | 'catppuccin-latte' | 'dracula' | 'github-light';
|
|
6
6
|
interface ColorinoOptions {
|
|
7
7
|
disableWarnings?: boolean;
|
|
8
8
|
theme?: TerminalTheme | ThemeName | 'auto';
|