@palett/presets
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -133,20 +133,2 @@ 'use strict'; | ||
/** | ||
* Create a dye from a hsl array | ||
* @param {[number,number,number]} hsl | ||
* @returns {function} | ||
*/ | ||
const hslToDye = hsl => { | ||
var _ref, _hsl; | ||
return _ref = (_hsl = hsl, convert.hslToRgb(_hsl)), dye.Dye(_ref); | ||
}; | ||
const parseHsl = color => { | ||
var _color; | ||
return typeof color === enumDataTypes.STR ? (_color = color, convert.hexToHsl(_color)) : color; | ||
}; | ||
/** | ||
* @param {Object} [preset] | ||
@@ -158,9 +140,14 @@ * @param {string} preset.na | ||
const presetToFlat = preset => { | ||
var _ref, _na; | ||
var _ref, _preset$na; | ||
if (!preset) return oneself.oneself; | ||
const na = preset.na; | ||
return _ref = (_na = na, parseHsl(_na)), hslToDye(_ref); | ||
return !preset ? oneself.oneself : (_ref = (_preset$na = preset.na, convert.hexToRgb(_preset$na)), dye.Dye(_ref)); | ||
}; | ||
const isString = x => typeof x === enumDataTypes.STR; | ||
const parseHsl = some => { | ||
var _some; | ||
return isString(some) ? (_some = some, convert.hexToHsl(_some)) : some; | ||
}; | ||
/** | ||
@@ -174,5 +161,10 @@ * | ||
const presetToLeap = preset => { | ||
if (!preset) return null; | ||
return colorBound(parseHsl(preset.max), parseHsl(preset.min)); | ||
const { | ||
max, | ||
min | ||
} = preset; | ||
return colorBound(parseHsl(max), parseHsl(min)); | ||
}; | ||
@@ -179,0 +171,0 @@ /** |
import { Palett } from '@palett/cards'; | ||
import { randBetw } from '@aryth/rand'; | ||
import { hexToHsl, hslToHex, hslToRgb } from '@palett/convert'; | ||
import { hexToHsl, hslToHex, hexToRgb } from '@palett/convert'; | ||
import { toner } from '@palett/toner-hsl'; | ||
@@ -129,20 +129,2 @@ import { oneself } from '@ject/oneself'; | ||
/** | ||
* Create a dye from a hsl array | ||
* @param {[number,number,number]} hsl | ||
* @returns {function} | ||
*/ | ||
const hslToDye = hsl => { | ||
var _ref, _hsl; | ||
return _ref = (_hsl = hsl, hslToRgb(_hsl)), Dye(_ref); | ||
}; | ||
const parseHsl = color => { | ||
var _color; | ||
return typeof color === STR ? (_color = color, hexToHsl(_color)) : color; | ||
}; | ||
/** | ||
* @param {Object} [preset] | ||
@@ -154,9 +136,14 @@ * @param {string} preset.na | ||
const presetToFlat = preset => { | ||
var _ref, _na; | ||
var _ref, _preset$na; | ||
if (!preset) return oneself; | ||
const na = preset.na; | ||
return _ref = (_na = na, parseHsl(_na)), hslToDye(_ref); | ||
return !preset ? oneself : (_ref = (_preset$na = preset.na, hexToRgb(_preset$na)), Dye(_ref)); | ||
}; | ||
const isString = x => typeof x === STR; | ||
const parseHsl = some => { | ||
var _some; | ||
return isString(some) ? (_some = some, hexToHsl(_some)) : some; | ||
}; | ||
/** | ||
@@ -170,5 +157,10 @@ * | ||
const presetToLeap = preset => { | ||
if (!preset) return null; | ||
return colorBound(parseHsl(preset.max), parseHsl(preset.min)); | ||
const { | ||
max, | ||
min | ||
} = preset; | ||
return colorBound(parseHsl(max), parseHsl(min)); | ||
}; | ||
@@ -175,0 +167,0 @@ /** |
{ | ||
"name": "@palett/presets", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "A color converter", | ||
@@ -20,6 +20,6 @@ "main": "dist/index.cjs.js", | ||
"@ject/oneself": "^0.0.6", | ||
"@palett/cards": "^0.7.4", | ||
"@palett/convert": "^0.7.4", | ||
"@palett/dye": "^0.7.4", | ||
"@palett/toner-hsl": "^0.7.4", | ||
"@palett/cards": "^0.7.5", | ||
"@palett/convert": "^0.7.5", | ||
"@palett/dye": "^0.7.5", | ||
"@palett/toner-hsl": "^0.7.5", | ||
"@typen/enum-data-types": "^0.1.16" | ||
@@ -48,3 +48,3 @@ }, | ||
"homepage": "https://github.com/hoyeungw/palett/presets#readme", | ||
"gitHead": "423afef9417bc4d5038acf67f95bb160f3b1b0c2" | ||
"gitHead": "7797ac849463ab4a089d53dd14a72cabde0e702d" | ||
} |
11828
343
Updated@palett/cards@^0.7.5
Updated@palett/convert@^0.7.5
Updated@palett/dye@^0.7.5
Updated@palett/toner-hsl@^0.7.5