@hsds/utils-color
Advanced tools
Comparing version 8.1.1 to 8.2.0
@@ -5,2 +5,17 @@ # Changelog | ||
## [8.2.0](https://github.com/helpscout/hsds/compare/utils-color-8.1.1...utils-color-8.2.0) (2023-10-23) | ||
### Dependency Updates | ||
* `tokens` updated to version `1.3.0` | ||
### Features | ||
* **workspace:** nx 16.8 ([fc69225](https://github.com/helpscout/hsds/commit/fc6922528431b16fdaf25bde4202c0b1c015935a)) | ||
### Bug Fixes | ||
* **workspace:** remove the newly generated dts files ([88d0308](https://github.com/helpscout/hsds/commit/88d0308c83078e171333c390ae5f22d5e1529393)) | ||
### [8.1.1](https://github.com/helpscout/hsds/compare/utils-color-8.1.0...utils-color-8.1.1) (2023-09-27) | ||
@@ -7,0 +22,0 @@ |
46
color.js
@@ -39,6 +39,3 @@ "use strict"; | ||
exports.hexToHsl = hexToHsl; | ||
const optimalTextColor = function (backgroundHex, propValues) { | ||
if (propValues === void 0) { | ||
propValues = optimalTextColorValues; | ||
} | ||
const optimalTextColor = (backgroundHex, propValues = optimalTextColorValues) => { | ||
if (!isHex(backgroundHex)) return null; | ||
@@ -116,6 +113,3 @@ // Defaults from original formula: | ||
exports.lightenDarkenColor = lightenDarkenColor; | ||
const lighten = function (hex, value) { | ||
if (value === void 0) { | ||
value = 20; | ||
} | ||
const lighten = (hex, value = 20) => { | ||
if (!isHex(hex) || typeof value !== 'number') return null; | ||
@@ -125,6 +119,3 @@ return lightenDarkenColor(hex, value * 2.55); | ||
exports.lighten = lighten; | ||
const darken = function (hex, value) { | ||
if (value === void 0) { | ||
value = 20; | ||
} | ||
const darken = (hex, value = 20) => { | ||
if (!isHex(hex) || typeof value !== 'number') return null; | ||
@@ -134,6 +125,3 @@ return lightenDarkenColor(hex, value * 2.55 * -1); | ||
exports.darken = darken; | ||
const getColorShade = function (hex, propValues) { | ||
if (propValues === void 0) { | ||
propValues = optimalTextColorValues; | ||
} | ||
const getColorShade = (hex, propValues = optimalTextColorValues) => { | ||
const hsl = hexToHsl(hex); | ||
@@ -153,6 +141,3 @@ const l = hsl.l; | ||
exports.getColorShade = getColorShade; | ||
function rgba(hex, opacity) { | ||
if (opacity === void 0) { | ||
opacity = 1; | ||
} | ||
function rgba(hex, opacity = 1) { | ||
const { | ||
@@ -170,6 +155,3 @@ r, | ||
} | ||
const getColor = function (colorPath, alpha) { | ||
if (alpha === void 0) { | ||
alpha = null; | ||
} | ||
const getColor = (colorPath, alpha = null) => { | ||
if (!colorPath) return 'currentColor'; | ||
@@ -191,6 +173,3 @@ if (!colorPath.includes('.')) colorPath += '.default'; | ||
exports.getColor = getColor; | ||
const getColorHex = function (colorCode, theme) { | ||
if (theme === void 0) { | ||
theme = 'default'; | ||
} | ||
const getColorHex = (colorCode, theme = 'default') => { | ||
const colorScheme = theme === 'newBrand' ? _tokens.newBrandTheme.color : _tokens.defaultTheme.color; | ||
@@ -229,12 +208,3 @@ const defaultColor = 'currentColor'; | ||
exports.getColorHex = getColorHex; | ||
const getThemeBrandProp = function (props, path, fallback) { | ||
if (props === void 0) { | ||
props = {}; | ||
} | ||
if (path === void 0) { | ||
path = ''; | ||
} | ||
if (fallback === void 0) { | ||
fallback = ''; | ||
} | ||
const getThemeBrandProp = (props = {}, path = '', fallback = '') => { | ||
return (0, _lodash.default)(props, `theme.brandColor.${path}`, fallback); | ||
@@ -241,0 +211,0 @@ }; |
{ | ||
"name": "@hsds/utils-color", | ||
"version": "8.1.1", | ||
"main": "./index.cjs", | ||
"version": "8.2.0", | ||
"main": "./index.cjs.js", | ||
"type": "commonjs", | ||
"types": "./src/index.d.ts", | ||
"dependencies": { | ||
@@ -8,0 +7,0 @@ "lodash.get": "4.4.2", |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
74654
9
2160
1