colorino 0.10.0 → 0.11.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 +96 -65
- package/dist/browser.bundle.cjs +129 -118
- package/dist/browser.bundle.mjs +130 -118
- package/dist/browser.cjs +13 -14
- package/dist/browser.d.cts +5 -5
- package/dist/browser.d.mts +5 -5
- package/dist/browser.d.ts +5 -5
- package/dist/browser.mjs +6 -6
- package/dist/node.cjs +59 -126
- package/dist/node.d.cts +3 -6
- package/dist/node.d.mts +3 -6
- package/dist/node.d.ts +3 -6
- package/dist/node.mjs +42 -108
- package/dist/shared/{colorino.B23laVKA.mjs → colorino.BPD_4Zhq.mjs} +126 -121
- package/dist/shared/{colorino.Y3oJ89MM.cjs → colorino.D9xuyiJg.cjs} +126 -124
- package/dist/shared/colorino.bX_hrCT6.d.cts +21 -0
- package/dist/shared/colorino.bX_hrCT6.d.mts +21 -0
- package/dist/shared/colorino.bX_hrCT6.d.ts +21 -0
- package/package.json +2 -1
- package/dist/shared/colorino.DVUvKR4R.d.cts +0 -465
- package/dist/shared/colorino.DVUvKR4R.d.mts +0 -465
- package/dist/shared/colorino.DVUvKR4R.d.ts +0 -465
package/dist/browser.bundle.mjs
CHANGED
|
@@ -61,13 +61,115 @@ function isConsoleMethod(level) {
|
|
|
61
61
|
return ["log", "info", "warn", "error", "trace", "debug"].includes(level);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const catppuccinMochaPalette = {
|
|
65
|
+
log: "#cdd6f4",
|
|
66
|
+
// Text
|
|
67
|
+
info: "#89b4fa",
|
|
68
|
+
// Blue
|
|
69
|
+
warn: "#f9e2af",
|
|
70
|
+
// Yellow
|
|
71
|
+
error: "#f38ba8",
|
|
72
|
+
// Red
|
|
73
|
+
debug: "#a6adc8",
|
|
74
|
+
// Subtext0
|
|
75
|
+
trace: "#9399b2"
|
|
76
|
+
// Subtext1
|
|
77
|
+
};
|
|
78
|
+
const catppuccinLattePalette = {
|
|
79
|
+
log: "#4c4f69",
|
|
80
|
+
// Text
|
|
81
|
+
info: "#1e66f5",
|
|
82
|
+
// Blue
|
|
83
|
+
warn: "#df8e1d",
|
|
84
|
+
// Yellow
|
|
85
|
+
error: "#d20f39",
|
|
86
|
+
// Red
|
|
87
|
+
debug: "#7c7f93",
|
|
88
|
+
// Subtext0
|
|
89
|
+
trace: "#8c8fa1"
|
|
90
|
+
// Subtext1
|
|
91
|
+
};
|
|
92
|
+
const draculaPalette = {
|
|
93
|
+
log: "#f8f8f2",
|
|
94
|
+
// Foreground
|
|
95
|
+
info: "#8be9fd",
|
|
96
|
+
// Cyan
|
|
97
|
+
warn: "#f1fa8c",
|
|
98
|
+
// Yellow
|
|
99
|
+
error: "#ff5555",
|
|
100
|
+
// Red
|
|
101
|
+
debug: "#bd93f9",
|
|
102
|
+
// Purple
|
|
103
|
+
trace: "#6272a4"
|
|
104
|
+
// Comment
|
|
105
|
+
};
|
|
106
|
+
const githubLightPalette = {
|
|
107
|
+
log: "#24292e",
|
|
108
|
+
// Text
|
|
109
|
+
info: "#0366d6",
|
|
110
|
+
// Blue
|
|
111
|
+
warn: "#f9a002",
|
|
112
|
+
// Yellow
|
|
113
|
+
error: "#d73a49",
|
|
114
|
+
// Red
|
|
115
|
+
debug: "#586069",
|
|
116
|
+
// Gray
|
|
117
|
+
trace: "#6a737d"
|
|
118
|
+
// Gray-light
|
|
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
|
+
|
|
137
|
+
const themePalettes = {
|
|
138
|
+
"catppuccin-mocha": catppuccinMochaPalette,
|
|
139
|
+
"catppuccin-latte": catppuccinLattePalette,
|
|
140
|
+
dracula: draculaPalette,
|
|
141
|
+
"github-light": githubLightPalette,
|
|
142
|
+
"minimal-dark": minimalDarkPalette,
|
|
143
|
+
"minimal-light": minimalLightPalette
|
|
144
|
+
};
|
|
145
|
+
const defaultDarkTheme = "minimal-dark";
|
|
146
|
+
const defaultLightTheme = "minimal-light";
|
|
147
|
+
function isThemeName(theme) {
|
|
148
|
+
return theme in themePalettes;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function determineBaseTheme(themeOpt, detectedBrowserTheme) {
|
|
152
|
+
let baseThemeName;
|
|
153
|
+
if (isThemeName(themeOpt)) {
|
|
154
|
+
baseThemeName = themeOpt;
|
|
155
|
+
} else if (themeOpt === "light") {
|
|
156
|
+
baseThemeName = defaultLightTheme;
|
|
157
|
+
} else if (themeOpt === "dark") {
|
|
158
|
+
baseThemeName = defaultDarkTheme;
|
|
159
|
+
} else {
|
|
160
|
+
baseThemeName = detectedBrowserTheme === "light" ? defaultLightTheme : defaultDarkTheme;
|
|
161
|
+
}
|
|
162
|
+
return baseThemeName;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
class MyColorino {
|
|
166
|
+
constructor(initialPalette, _userPalette, _validator, _browserColorSupportDetector, _nodeColorSupportDetector, _options = {}) {
|
|
167
|
+
this._userPalette = _userPalette;
|
|
67
168
|
this._validator = _validator;
|
|
68
169
|
this._browserColorSupportDetector = _browserColorSupportDetector;
|
|
69
170
|
this._nodeColorSupportDetector = _nodeColorSupportDetector;
|
|
70
171
|
this._options = _options;
|
|
172
|
+
this._palette = initialPalette;
|
|
71
173
|
this.isBrowser = !!this._browserColorSupportDetector;
|
|
72
174
|
this._colorLevel = this._detectColorSupport();
|
|
73
175
|
const validatePaletteResult = this._validator.validatePalette(this._palette);
|
|
@@ -75,10 +177,23 @@ class Colorino {
|
|
|
75
177
|
if (this._colorLevel !== ColorLevel.NO_COLOR && !this._options.disableWarnings && this._colorLevel === "UnknownEnv") {
|
|
76
178
|
this._maybeWarnUser();
|
|
77
179
|
}
|
|
180
|
+
const themeOpt = this._options.theme ?? "auto";
|
|
181
|
+
if (themeOpt === "auto" && this._nodeColorSupportDetector) {
|
|
182
|
+
this._nodeColorSupportDetector.onTheme((resolvedTheme) => {
|
|
183
|
+
this._appllyResolvedTheme(resolvedTheme);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
78
186
|
}
|
|
79
187
|
_alreadyWarned = false;
|
|
80
188
|
_colorLevel;
|
|
81
189
|
isBrowser;
|
|
190
|
+
_palette;
|
|
191
|
+
_appllyResolvedTheme(resolvedTheme) {
|
|
192
|
+
const themeOpt = this._options.theme ?? "auto";
|
|
193
|
+
const baseThemeName = determineBaseTheme(themeOpt, resolvedTheme);
|
|
194
|
+
const basePalette = themePalettes[baseThemeName];
|
|
195
|
+
this._palette = { ...basePalette, ...this._userPalette };
|
|
196
|
+
}
|
|
82
197
|
log(...args) {
|
|
83
198
|
this._out("log", args);
|
|
84
199
|
}
|
|
@@ -110,10 +225,10 @@ class Colorino {
|
|
|
110
225
|
if (this._alreadyWarned) return;
|
|
111
226
|
this._alreadyWarned = true;
|
|
112
227
|
console.warn(
|
|
113
|
-
"
|
|
228
|
+
"No ANSI color support detected in this terminal. See [https://github.com/chalk/supports-color#support-matrix](https://github.com/chalk/supports-color#support-matrix) to learn how to enable terminal color."
|
|
114
229
|
);
|
|
115
230
|
}
|
|
116
|
-
_formatValue(value, maxDepth = 5) {
|
|
231
|
+
_formatValue(value, maxDepth = this._options.maxDepth ?? 5) {
|
|
117
232
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
118
233
|
const sanitize = (val, currentDepth) => {
|
|
119
234
|
if (val === null || typeof val !== "object") return val;
|
|
@@ -198,7 +313,7 @@ ${arg}`);
|
|
|
198
313
|
}
|
|
199
314
|
_output(consoleMethod, args) {
|
|
200
315
|
if (consoleMethod === "trace") {
|
|
201
|
-
this._printCleanTrace(args
|
|
316
|
+
this._printCleanTrace(args);
|
|
202
317
|
} else {
|
|
203
318
|
console[consoleMethod](...args);
|
|
204
319
|
}
|
|
@@ -219,9 +334,7 @@ ${arg}`);
|
|
|
219
334
|
this._output(consoleMethod, coloredArgs);
|
|
220
335
|
}
|
|
221
336
|
_filterStack(stack) {
|
|
222
|
-
return stack.split("\n").filter(
|
|
223
|
-
(line) => !line.includes("colorino.js") && !line.includes("Colorino._out") && !line.includes("Colorino.error") && !line.includes("Colorino.warn") && !line.includes("Colorino.debug") && !line.includes("Colorino.info") && !line.includes("Colorino.log") && !line.includes("Colorino.trace") && !line.includes("Colorino._cleanErrorStack") && !line.includes("Colorino._printCleanTrace") && !line.includes("Colorino._filterStack")
|
|
224
|
-
).join("\n");
|
|
337
|
+
return stack.split("\n").filter((line) => !line.match(/.*colorino.*/gi)).join("\n");
|
|
225
338
|
}
|
|
226
339
|
_cleanErrorStack(error) {
|
|
227
340
|
if (!error.stack) return error;
|
|
@@ -231,14 +344,14 @@ ${arg}`);
|
|
|
231
344
|
cloned.stack = cleanStack;
|
|
232
345
|
return cloned;
|
|
233
346
|
}
|
|
234
|
-
_printCleanTrace(args
|
|
347
|
+
_printCleanTrace(args) {
|
|
235
348
|
const error = new Error();
|
|
236
349
|
if (error.stack) {
|
|
237
350
|
const cleanStack = this._filterStack(error.stack);
|
|
238
|
-
console
|
|
351
|
+
console.log(...args, `
|
|
239
352
|
${cleanStack}`);
|
|
240
353
|
} else {
|
|
241
|
-
console
|
|
354
|
+
console.log(...args);
|
|
242
355
|
}
|
|
243
356
|
}
|
|
244
357
|
}
|
|
@@ -754,107 +867,6 @@ class InputValidator {
|
|
|
754
867
|
}
|
|
755
868
|
}
|
|
756
869
|
|
|
757
|
-
const catppuccinMochaPalette = {
|
|
758
|
-
log: "#cdd6f4",
|
|
759
|
-
// Text
|
|
760
|
-
info: "#89b4fa",
|
|
761
|
-
// Blue
|
|
762
|
-
warn: "#f9e2af",
|
|
763
|
-
// Yellow
|
|
764
|
-
error: "#f38ba8",
|
|
765
|
-
// Red
|
|
766
|
-
debug: "#a6adc8",
|
|
767
|
-
// Subtext0
|
|
768
|
-
trace: "#9399b2"
|
|
769
|
-
// Subtext1
|
|
770
|
-
};
|
|
771
|
-
const catppuccinLattePalette = {
|
|
772
|
-
log: "#4c4f69",
|
|
773
|
-
// Text
|
|
774
|
-
info: "#1e66f5",
|
|
775
|
-
// Blue
|
|
776
|
-
warn: "#df8e1d",
|
|
777
|
-
// Yellow
|
|
778
|
-
error: "#d20f39",
|
|
779
|
-
// Red
|
|
780
|
-
debug: "#7c7f93",
|
|
781
|
-
// Subtext0
|
|
782
|
-
trace: "#8c8fa1"
|
|
783
|
-
// Subtext1
|
|
784
|
-
};
|
|
785
|
-
const draculaPalette = {
|
|
786
|
-
log: "#f8f8f2",
|
|
787
|
-
// Foreground
|
|
788
|
-
info: "#8be9fd",
|
|
789
|
-
// Cyan
|
|
790
|
-
warn: "#f1fa8c",
|
|
791
|
-
// Yellow
|
|
792
|
-
error: "#ff5555",
|
|
793
|
-
// Red
|
|
794
|
-
debug: "#bd93f9",
|
|
795
|
-
// Purple
|
|
796
|
-
trace: "#6272a4"
|
|
797
|
-
// Comment
|
|
798
|
-
};
|
|
799
|
-
const githubLightPalette = {
|
|
800
|
-
log: "#24292e",
|
|
801
|
-
// Text
|
|
802
|
-
info: "#0366d6",
|
|
803
|
-
// Blue
|
|
804
|
-
warn: "#f9a002",
|
|
805
|
-
// Yellow
|
|
806
|
-
error: "#d73a49",
|
|
807
|
-
// Red
|
|
808
|
-
debug: "#586069",
|
|
809
|
-
// Gray
|
|
810
|
-
trace: "#6a737d"
|
|
811
|
-
// Gray-light
|
|
812
|
-
};
|
|
813
|
-
const minimalDarkPalette = {
|
|
814
|
-
log: "#ffffff",
|
|
815
|
-
info: "#ffffff",
|
|
816
|
-
warn: "#ffffff",
|
|
817
|
-
error: "#ffffff",
|
|
818
|
-
debug: "#ffffff",
|
|
819
|
-
trace: "#ffffff"
|
|
820
|
-
};
|
|
821
|
-
const minimalLightPalette = {
|
|
822
|
-
log: "#000000",
|
|
823
|
-
info: "#000000",
|
|
824
|
-
warn: "#000000",
|
|
825
|
-
error: "#000000",
|
|
826
|
-
debug: "#000000",
|
|
827
|
-
trace: "#000000"
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
const themePalettes = {
|
|
831
|
-
"catppuccin-mocha": catppuccinMochaPalette,
|
|
832
|
-
"catppuccin-latte": catppuccinLattePalette,
|
|
833
|
-
dracula: draculaPalette,
|
|
834
|
-
"github-light": githubLightPalette,
|
|
835
|
-
"minimal-dark": minimalDarkPalette,
|
|
836
|
-
"minimal-light": minimalLightPalette
|
|
837
|
-
};
|
|
838
|
-
const defaultDarkTheme = "minimal-dark";
|
|
839
|
-
const defaultLightTheme = "minimal-light";
|
|
840
|
-
function isThemeName(theme) {
|
|
841
|
-
return theme in themePalettes;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
function determineBaseTheme(themeOpt, detectedBrowserTheme) {
|
|
845
|
-
let baseThemeName;
|
|
846
|
-
if (isThemeName(themeOpt)) {
|
|
847
|
-
baseThemeName = themeOpt;
|
|
848
|
-
} else if (themeOpt === "light") {
|
|
849
|
-
baseThemeName = defaultLightTheme;
|
|
850
|
-
} else if (themeOpt === "dark") {
|
|
851
|
-
baseThemeName = defaultDarkTheme;
|
|
852
|
-
} else {
|
|
853
|
-
baseThemeName = detectedBrowserTheme === "light" ? defaultLightTheme : defaultDarkTheme;
|
|
854
|
-
}
|
|
855
|
-
return baseThemeName;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
870
|
class BrowserColorSupportDetector {
|
|
859
871
|
constructor(_window, _navigator, _overrideTheme) {
|
|
860
872
|
this._window = _window;
|
|
@@ -890,7 +902,7 @@ class BrowserColorSupportDetector {
|
|
|
890
902
|
}
|
|
891
903
|
}
|
|
892
904
|
|
|
893
|
-
function createColorino(
|
|
905
|
+
function createColorino(userPalette = {}, options = {}) {
|
|
894
906
|
const validator = new InputValidator();
|
|
895
907
|
let detectorThemeOverride;
|
|
896
908
|
if (options.theme === "dark" || options.theme === "light") {
|
|
@@ -908,9 +920,10 @@ function createColorino(palette = {}, options = {}) {
|
|
|
908
920
|
detectedBrowserTheme
|
|
909
921
|
);
|
|
910
922
|
const basePalette = themePalettes[baseThemeName];
|
|
911
|
-
const finalPalette = { ...basePalette, ...
|
|
912
|
-
return new
|
|
923
|
+
const finalPalette = { ...basePalette, ...userPalette };
|
|
924
|
+
return new MyColorino(
|
|
913
925
|
finalPalette,
|
|
926
|
+
userPalette,
|
|
914
927
|
validator,
|
|
915
928
|
browserDetector,
|
|
916
929
|
// Always use browser detector
|
|
@@ -919,6 +932,5 @@ function createColorino(palette = {}, options = {}) {
|
|
|
919
932
|
options
|
|
920
933
|
);
|
|
921
934
|
}
|
|
922
|
-
const colorino = createColorino();
|
|
923
935
|
|
|
924
|
-
export {
|
|
936
|
+
export { createColorino, themePalettes };
|
package/dist/browser.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const inputValidator = require('./shared/colorino.D9xuyiJg.cjs');
|
|
4
4
|
|
|
5
5
|
class BrowserColorSupportDetector {
|
|
6
6
|
constructor(_window, _navigator, _overrideTheme) {
|
|
@@ -13,12 +13,12 @@ class BrowserColorSupportDetector {
|
|
|
13
13
|
}
|
|
14
14
|
getColorLevel() {
|
|
15
15
|
if (!this.isBrowserEnv()) {
|
|
16
|
-
return
|
|
16
|
+
return inputValidator.ColorLevel.NO_COLOR;
|
|
17
17
|
}
|
|
18
18
|
const userAgent = this._navigator.userAgent.toLowerCase();
|
|
19
|
-
if (userAgent.includes("chrome")) return
|
|
20
|
-
if (userAgent.includes("firefox")) return
|
|
21
|
-
return
|
|
19
|
+
if (userAgent.includes("chrome")) return inputValidator.ColorLevel.ANSI256;
|
|
20
|
+
if (userAgent.includes("firefox")) return inputValidator.ColorLevel.ANSI256;
|
|
21
|
+
return inputValidator.ColorLevel.ANSI256;
|
|
22
22
|
}
|
|
23
23
|
getTheme() {
|
|
24
24
|
if (this._overrideTheme) {
|
|
@@ -37,8 +37,8 @@ class BrowserColorSupportDetector {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function createColorino(
|
|
41
|
-
const validator = new
|
|
40
|
+
function createColorino(userPalette = {}, options = {}) {
|
|
41
|
+
const validator = new inputValidator.InputValidator();
|
|
42
42
|
let detectorThemeOverride;
|
|
43
43
|
if (options.theme === "dark" || options.theme === "light") {
|
|
44
44
|
detectorThemeOverride = options.theme;
|
|
@@ -50,14 +50,15 @@ function createColorino(palette = {}, options = {}) {
|
|
|
50
50
|
);
|
|
51
51
|
const detectedBrowserTheme = browserDetector.getTheme();
|
|
52
52
|
const themeOpt = options.theme ?? "auto";
|
|
53
|
-
const baseThemeName =
|
|
53
|
+
const baseThemeName = inputValidator.determineBaseTheme(
|
|
54
54
|
themeOpt,
|
|
55
55
|
detectedBrowserTheme
|
|
56
56
|
);
|
|
57
|
-
const basePalette =
|
|
58
|
-
const finalPalette = { ...basePalette, ...
|
|
59
|
-
return new
|
|
57
|
+
const basePalette = inputValidator.themePalettes[baseThemeName];
|
|
58
|
+
const finalPalette = { ...basePalette, ...userPalette };
|
|
59
|
+
return new inputValidator.MyColorino(
|
|
60
60
|
finalPalette,
|
|
61
|
+
userPalette,
|
|
61
62
|
validator,
|
|
62
63
|
browserDetector,
|
|
63
64
|
// Always use browser detector
|
|
@@ -66,8 +67,6 @@ function createColorino(palette = {}, options = {}) {
|
|
|
66
67
|
options
|
|
67
68
|
);
|
|
68
69
|
}
|
|
69
|
-
const colorino = createColorino();
|
|
70
70
|
|
|
71
|
-
exports.themePalettes =
|
|
72
|
-
exports.colorino = colorino;
|
|
71
|
+
exports.themePalettes = inputValidator.themePalettes;
|
|
73
72
|
exports.createColorino = createColorino;
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
2
|
-
export { L as LogLevel
|
|
1
|
+
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.bX_hrCT6.cjs';
|
|
2
|
+
export { L as LogLevel } from './shared/colorino.bX_hrCT6.cjs';
|
|
3
3
|
|
|
4
|
-
declare
|
|
4
|
+
declare const themePalettes: Record<ThemeName, Palette>;
|
|
5
5
|
|
|
6
|
-
declare
|
|
6
|
+
declare function createColorino(userPalette?: Partial<Palette>, options?: ColorinoOptions): Colorino;
|
|
7
7
|
|
|
8
|
-
export { ColorinoOptions, Palette,
|
|
8
|
+
export { Colorino, ColorinoOptions, Palette, ThemeName, createColorino, themePalettes };
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
2
|
-
export { L as LogLevel
|
|
1
|
+
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.bX_hrCT6.mjs';
|
|
2
|
+
export { L as LogLevel } from './shared/colorino.bX_hrCT6.mjs';
|
|
3
3
|
|
|
4
|
-
declare
|
|
4
|
+
declare const themePalettes: Record<ThemeName, Palette>;
|
|
5
5
|
|
|
6
|
-
declare
|
|
6
|
+
declare function createColorino(userPalette?: Partial<Palette>, options?: ColorinoOptions): Colorino;
|
|
7
7
|
|
|
8
|
-
export { ColorinoOptions, Palette,
|
|
8
|
+
export { Colorino, ColorinoOptions, Palette, ThemeName, createColorino, themePalettes };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.
|
|
2
|
-
export { L as LogLevel
|
|
1
|
+
import { T as ThemeName, P as Palette, C as ColorinoOptions, a as Colorino } from './shared/colorino.bX_hrCT6.js';
|
|
2
|
+
export { L as LogLevel } from './shared/colorino.bX_hrCT6.js';
|
|
3
3
|
|
|
4
|
-
declare
|
|
4
|
+
declare const themePalettes: Record<ThemeName, Palette>;
|
|
5
5
|
|
|
6
|
-
declare
|
|
6
|
+
declare function createColorino(userPalette?: Partial<Palette>, options?: ColorinoOptions): Colorino;
|
|
7
7
|
|
|
8
|
-
export { ColorinoOptions, Palette,
|
|
8
|
+
export { Colorino, ColorinoOptions, Palette, ThemeName, createColorino, themePalettes };
|
package/dist/browser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ColorLevel, t as themePalettes,
|
|
1
|
+
import { C as ColorLevel, t as themePalettes, M as MyColorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.BPD_4Zhq.mjs';
|
|
2
2
|
|
|
3
3
|
class BrowserColorSupportDetector {
|
|
4
4
|
constructor(_window, _navigator, _overrideTheme) {
|
|
@@ -35,7 +35,7 @@ class BrowserColorSupportDetector {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function createColorino(
|
|
38
|
+
function createColorino(userPalette = {}, options = {}) {
|
|
39
39
|
const validator = new InputValidator();
|
|
40
40
|
let detectorThemeOverride;
|
|
41
41
|
if (options.theme === "dark" || options.theme === "light") {
|
|
@@ -53,9 +53,10 @@ function createColorino(palette = {}, options = {}) {
|
|
|
53
53
|
detectedBrowserTheme
|
|
54
54
|
);
|
|
55
55
|
const basePalette = themePalettes[baseThemeName];
|
|
56
|
-
const finalPalette = { ...basePalette, ...
|
|
57
|
-
return new
|
|
56
|
+
const finalPalette = { ...basePalette, ...userPalette };
|
|
57
|
+
return new MyColorino(
|
|
58
58
|
finalPalette,
|
|
59
|
+
userPalette,
|
|
59
60
|
validator,
|
|
60
61
|
browserDetector,
|
|
61
62
|
// Always use browser detector
|
|
@@ -64,6 +65,5 @@ function createColorino(palette = {}, options = {}) {
|
|
|
64
65
|
options
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
|
-
const colorino = createColorino();
|
|
68
68
|
|
|
69
|
-
export {
|
|
69
|
+
export { createColorino, themePalettes };
|