colorino 0.9.0 β†’ 0.10.0

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 CHANGED
@@ -9,21 +9,22 @@ Colorino automatically adapts its palette to your terminal or browser DevTools t
9
9
  - [Why use Colorino?](#1)
10
10
  - [Features](#2)
11
11
  - [Installation](#3)
12
- - [Usage](#4)
13
- - [Quick Start](#4-1)
14
- - [Creating a Custom Logger](#4-2)
15
- - [Options & Theme Overrides](#4-3)
16
- - [Available Theme Presets](#4-3-1)
17
- - [Examples](#4-3-2)
18
- - [Customization](#4-4)
19
- - [Supported Environment Variables](#4-5)
20
- - [Colorino vs. Chalk](#5)
21
- - [API Reference](#6)
22
- - [1. `colorino` (default instance)](#6-1)
23
- - [2. `createColorino(palette?, options?)` (factory)](#6-2)
24
- - [Extending Colorino](#7)
25
- - [Why This Pattern?](#7-1)
26
- - [License](#8)
12
+ - [Browser via CDN (unpkg)](#4)
13
+ - [Usage](#5)
14
+ - [Quick Start](#5-1)
15
+ - [Creating a Custom Logger](#5-2)
16
+ - [Options & Theme Overrides](#5-3)
17
+ - [Available Theme Presets](#5-3-1)
18
+ - [Examples](#5-3-2)
19
+ - [Customization](#5-4)
20
+ - [Supported Environment Variables](#5-5)
21
+ - [Colorino vs. Chalk](#6)
22
+ - [API Reference](#7)
23
+ - [1. `colorino` (default instance)](#7-1)
24
+ - [2. `createColorino(palette?, options?)` (factory)](#7-2)
25
+ - [Extending Colorino](#8)
26
+ - [Why This Pattern?](#8-1)
27
+ - [License](#9)
27
28
 
28
29
  <!-- Table of contents is made with https://github.com/eugene-khyst/md-toc-cli -->
29
30
 
@@ -48,9 +49,46 @@ Colorino is different: it’s a "batteries-included" logging facade with beautif
48
49
  npm install colorino
49
50
  ```
50
51
 
51
- ## <a id="4"></a>Usage
52
+ ## <a id="4"></a>Browser via CDN (unpkg)
52
53
 
53
- ### <a id="4-1"></a>Quick Start
54
+ You can use Colorino directly in the browser without any build step.
55
+
56
+ **ESM (recommended):**
57
+
58
+ ```html
59
+ <!DOCTYPE html>
60
+ <html>
61
+ <head>
62
+ <script type="module">
63
+ import { colorino } from 'https://unpkg.com/colorino/dist/browser.bundle.mjs';
64
+
65
+ colorino.info('Hello from the browser!');
66
+ colorino.error('Something went wrong');
67
+ </script>
68
+ </head>
69
+ <body></body>
70
+ </html>
71
+ ```
72
+
73
+ CommonJS-style bundle:
74
+
75
+ ```HTML
76
+ <!DOCTYPE html>
77
+ <html>
78
+ <head>
79
+ <script src="https://unpkg.com/colorino/dist/browser.bundle.cjs"></script>
80
+ <script>
81
+ // `colorino` is exposed as a global
82
+ colorino.info('Hello from the CJS bundle!');
83
+ </script>
84
+ </head>
85
+ <body></body>
86
+ </html>
87
+ ```
88
+
89
+ ## <a id="5"></a>Usage
90
+
91
+ ### <a id="5-1"></a>Quick Start
54
92
 
55
93
  Just import the default instance and log away!
56
94
 
@@ -66,7 +104,7 @@ colorino.debug('Debug with objects:', { x: 5, y: 9 })
66
104
  colorino.trace('Tracing app start...')
67
105
  ```
68
106
 
69
- ### <a id="4-2"></a>Creating a Custom Logger
107
+ ### <a id="5-2"></a>Creating a Custom Logger
70
108
 
71
109
  Need your own colors or different settings?
72
110
  Use the factory to create as many loggers as you want (each with its own palette and options):
@@ -85,7 +123,7 @@ myLogger.error('Critical!')
85
123
  myLogger.info('Rebranded info!')
86
124
  ```
87
125
 
88
- ### <a id="4-3"></a>Options & Theme Overrides
126
+ ### <a id="5-3"></a>Options & Theme Overrides
89
127
 
90
128
  `createColorino(palette?, options?)` accepts:
91
129
 
@@ -100,7 +138,7 @@ myLogger.info('Rebranded info!')
100
138
  2. **`'dark' | 'light'`**: Forces the logger into a specific mode using the default preset for that mode.
101
139
  3. **`ThemeName`**: Forces a specific built-in palette (e.g., `'dracula'`).
102
140
 
103
- #### <a id="4-3-1"></a>Available Theme Presets
141
+ #### <a id="5-3-1"></a>Available Theme Presets
104
142
 
105
143
  Pass any of these names to the `theme` option to use a specific palette:
106
144
 
@@ -113,9 +151,9 @@ Pass any of these names to the `theme` option to use a specific palette:
113
151
  | `'github-light'` | **Light** (High)| Clean, sharp, high-contrast. |
114
152
  | `'catppuccin-latte'` | **Light** (Low) | Warm, cozy light mode with soft colors. |
115
153
 
116
- #### <a id="4-3-2"></a>Examples
154
+ #### <a id="5-3-2"></a>Examples
117
155
 
118
- **1. Minimal defaults with custom branding (recommended):**
156
+ **1. Minimal defaults with custom branding:**
119
157
  Set only the colors you care about; everything else stays maximally readable.
120
158
 
121
159
  ```typescript
@@ -166,7 +204,7 @@ const myLogger = createColorino(
166
204
  > **Tip:**
167
205
  > Forcing `'dark'` or `'light'` bypasses automatic theming, ensuring predictable colors in environments with unknown or unsupported theme detection (like some CI pipelines, dumb terminals, or minimal browsers).
168
206
 
169
- ### <a id="4-4"></a>Customization
207
+ ### <a id="5-4"></a>Customization
170
208
 
171
209
  Use your brand colors by passing a partial palette to the `createColorino` factory. Any log levels you don't specify will use the detected **minimal** defaults (`minimal-dark` / `minimal-light`) unless you explicitly select a theme preset.
172
210
 
@@ -180,7 +218,7 @@ myLogger.error('Oh no!') // Uses your custom color
180
218
  myLogger.info('Still styled by theme.') // Uses the default theme color
181
219
  ```
182
220
 
183
- ### <a id="4-5"></a>Supported Environment Variables
221
+ ### <a id="5-5"></a>Supported Environment Variables
184
222
 
185
223
  Colorino auto-detects your environment and color support, but you can override behavior using these standard environment variables (compatible with Chalk):
186
224
 
@@ -195,7 +233,7 @@ Colorino auto-detects your environment and color support, but you can override b
195
233
  | `WT_SESSION` | Detected for Windows Terminal (enables color) | |
196
234
  | `CI` | Many CI platforms default to *no color* | `CI=1 node app.js` |
197
235
 
198
- ## <a id="5"></a>Colorino vs. Chalk
236
+ ## <a id="6"></a>Colorino vs. Chalk
199
237
 
200
238
  | Feature | 🎨 **Colorino** | πŸ–οΈ **Chalk** |
201
239
  |--------------------------|----------------------------|-----------------|
@@ -205,11 +243,11 @@ Colorino auto-detects your environment and color support, but you can override b
205
243
  | CSS console logs | βœ” | ✘ |
206
244
  | Extensible / Composable | βœ” (via factory) | ✘ |
207
245
 
208
- ## <a id="6"></a>API Reference
246
+ ## <a id="7"></a>API Reference
209
247
 
210
248
  The `colorino` package exports two main items:
211
249
 
212
- ### <a id="6-1"></a>1. `colorino` (default instance)
250
+ ### <a id="7-1"></a>1. `colorino` (default instance)
213
251
 
214
252
  A pre-configured, zero-setup logger instance. Just import and use.
215
253
 
@@ -220,7 +258,7 @@ A pre-configured, zero-setup logger instance. Just import and use.
220
258
  - `.debug(...args)`
221
259
  - `.trace(...args)`
222
260
 
223
- ### <a id="6-2"></a>2. `createColorino(palette?, options?)` (factory)
261
+ ### <a id="7-2"></a>2. `createColorino(palette?, options?)` (factory)
224
262
 
225
263
  A factory function to create your own customized logger instances.
226
264
 
@@ -229,7 +267,7 @@ A factory function to create your own customized logger instances.
229
267
  - `disableWarnings: boolean` (default `false`): Suppress warnings on environments with no color support.
230
268
  - `theme: 'dark' | 'light'` (default `auto`): Force a specific theme instead of auto-detecting.
231
269
 
232
- ## <a id="7"></a>Extending Colorino
270
+ ## <a id="8"></a>Extending Colorino
233
271
 
234
272
  Example: Add a `fatal()` logger for critical errors.
235
273
 
@@ -272,7 +310,7 @@ logger.info('Starting!')
272
310
  logger.fatal('Missing config: Exiting')
273
311
  ```
274
312
 
275
- ### <a id="7-1"></a>Why This Pattern?
313
+ ### <a id="8-1"></a>Why This Pattern?
276
314
 
277
315
  - **Composition > Inheritance**: No fragile base class problems
278
316
  - **Type Safe**: TypeScript infers the return type correctly
@@ -280,6 +318,6 @@ logger.fatal('Missing config: Exiting')
280
318
  - **Clean**: No messing with `super()` or constructor parameters
281
319
  - **Composable**: You can layer multiple extensions
282
320
 
283
- ## <a id="8"></a>License
321
+ ## <a id="9"></a>License
284
322
 
285
323
  [MIT](LICENSE.md)