stop triggering lazy loading of color converters on init
This commit is contained in:
parent
2a53389d72
commit
09e5a22cb7
1 changed files with 3 additions and 12 deletions
|
|
@ -15,9 +15,6 @@ const levelMapping = [
|
||||||
'ansi16m'
|
'ansi16m'
|
||||||
];
|
];
|
||||||
|
|
||||||
// `color-convert` models to exclude from the Chalk API due to conflicts and such
|
|
||||||
const skipModels = new Set(['gray']);
|
|
||||||
|
|
||||||
const styles = Object.create(null);
|
const styles = Object.create(null);
|
||||||
|
|
||||||
const applyOptions = (object, options = {}) => {
|
const applyOptions = (object, options = {}) => {
|
||||||
|
|
@ -76,11 +73,9 @@ styles.visible = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const model of Object.keys(ansiStyles.color.ansi)) {
|
const useModels = ['rgb', 'hsl', 'hsv', 'hwb', 'cmyk', 'xyz', 'lab', 'lch', 'hex', 'keyword', 'ansi', 'ansi256', 'hcg', 'apple'];
|
||||||
if (skipModels.has(model)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (const model of useModels) {
|
||||||
styles[model] = {
|
styles[model] = {
|
||||||
get() {
|
get() {
|
||||||
const {level} = this;
|
const {level} = this;
|
||||||
|
|
@ -92,11 +87,7 @@ for (const model of Object.keys(ansiStyles.color.ansi)) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
for (const model of useModels) {
|
||||||
if (skipModels.has(model)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||||
styles[bgModel] = {
|
styles[bgModel] = {
|
||||||
get() {
|
get() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue