make-color-more-chill
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -19,5 +19,13 @@ 'use strict'; | ||
var lighten = function lighten(color, hslPercent) { | ||
return color.set('hsl.l', color.get('hsl.l') + hslPercent); | ||
}; | ||
var darken = function darken(color, hslPercent) { | ||
return lighten(color, -hslPercent); | ||
}; | ||
function incrementChillness(color, theme) { | ||
var slightlyChillerColor = theme === Theme["enum"].dark ? c(color).brighten(0.02) : c(color).darken(0.02); | ||
return slightlyChillerColor.saturate(0.02).hex(); | ||
var slightlyChillerColor = theme === Theme["enum"].dark ? lighten(c(color), 0.02) : darken(c(color), 0.02); | ||
return slightlyChillerColor.saturate(0.04).hex(); | ||
} | ||
@@ -24,0 +32,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=(e=require("chroma-js"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("zod"),u="#ffffff",i=n.enum(["dark","light"]),o=((r={})[i.enum.dark]="#525B66",r[i.enum.light]="#25292E",r);function a(e,r){return(r===i.enum.dark?t(e).brighten(.02):t(e).darken(.02)).saturate(.02).hex()}function f(e){return"#000000"===t(e).hex()||t(e).hex()===u}function s(e,r){return void 0===r&&(r=u),Number(t.contrast(e,r).toFixed(2))>2.5}exports.Theme=i,exports.black="#000000",exports.default=function(e,r){void 0===r&&(r=u);var n=t.distance(u,r)>t.distance("#000000",r)?i.enum.dark:i.enum.light;if(f(e))return o[n];if(s(e,r))return e;for(var d=e;!s(d,r);)d=a(d,n);return d},exports.fallbackColors=o,exports.isBlackOrWhite=f,exports.isChill=s,exports.white=u; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=(e=require("chroma-js"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("zod"),u="#ffffff",o=n.enum(["dark","light"]),i=((r={})[o.enum.dark]="#525B66",r[o.enum.light]="#25292E",r),s=function(e,r){return e.set("hsl.l",e.get("hsl.l")+r)};function a(e,r){return(r===o.enum.dark?s(t(e),.02):function(e,r){return s(e,-.02)}(t(e))).saturate(.04).hex()}function f(e){return"#000000"===t(e).hex()||t(e).hex()===u}function l(e,r){return void 0===r&&(r=u),Number(t.contrast(e,r).toFixed(2))>2.5}exports.Theme=o,exports.black="#000000",exports.default=function(e,r){void 0===r&&(r=u);var n=t.distance(u,r)>t.distance("#000000",r)?o.enum.dark:o.enum.light;if(f(e))return i[n];if(l(e,r))return e;for(var s=e;!l(s,r);)s=a(s,n);return s},exports.fallbackColors=i,exports.isBlackOrWhite=f,exports.isChill=l,exports.white=u; | ||
//# sourceMappingURL=make-color-more-chill.cjs.production.min.js.map |
@@ -13,5 +13,13 @@ import c from 'chroma-js'; | ||
var lighten = function lighten(color, hslPercent) { | ||
return color.set('hsl.l', color.get('hsl.l') + hslPercent); | ||
}; | ||
var darken = function darken(color, hslPercent) { | ||
return lighten(color, -hslPercent); | ||
}; | ||
function incrementChillness(color, theme) { | ||
var slightlyChillerColor = theme === Theme["enum"].dark ? c(color).brighten(0.02) : c(color).darken(0.02); | ||
return slightlyChillerColor.saturate(0.02).hex(); | ||
var slightlyChillerColor = theme === Theme["enum"].dark ? lighten(c(color), 0.02) : darken(c(color), 0.02); | ||
return slightlyChillerColor.saturate(0.04).hex(); | ||
} | ||
@@ -18,0 +26,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"module": "dist/make-color-more-chill.esm.js", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
@@ -19,7 +19,13 @@ import c from 'chroma-js'; | ||
const lighten = (color: any, hslPercent: number) => | ||
color.set('hsl.l', color.get('hsl.l') + hslPercent); | ||
const darken = (color: any, hslPercent: number) => lighten(color, -hslPercent); | ||
function incrementChillness(color: string, theme: ThemeType) { | ||
const slightlyChillerColor = | ||
theme === Theme.enum.dark ? c(color).brighten(0.02) : c(color).darken(0.02); | ||
theme === Theme.enum.dark | ||
? lighten(c(color), 0.02) | ||
: darken(c(color), 0.02); | ||
return slightlyChillerColor.saturate(0.02).hex(); | ||
return slightlyChillerColor.saturate(0.04).hex(); | ||
} | ||
@@ -26,0 +32,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22549
173
1