@palett/presets
Advanced tools
Comparing version 0.7.9 to 0.7.10
@@ -9,5 +9,2 @@ 'use strict'; | ||
var tonerHsl = require('@palett/toner-hsl'); | ||
var oneself = require('@ject/oneself'); | ||
var dye = require('@palett/dye'); | ||
var enumDataTypes = require('@typen/enum-data-types'); | ||
@@ -133,50 +130,2 @@ const AQUA = { | ||
/** | ||
* @param {Object} [preset] | ||
* @param {string} preset.na | ||
* @return {Function} | ||
*/ | ||
const presetToFlat = preset => { | ||
var _ref, _preset$na; | ||
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; | ||
}; | ||
/** | ||
* | ||
* @param {Object} [preset] | ||
* @param {string} preset.max | ||
* @param {string} preset.min | ||
* @return {?{dif: number[], min: number[]}} | ||
*/ | ||
const presetToLeap = preset => { | ||
if (!preset) return null; | ||
const { | ||
max, | ||
min | ||
} = preset; | ||
return colorBound(parseHsl(max), parseHsl(min)); | ||
}; | ||
/** | ||
* | ||
* @param max | ||
* @param min | ||
* @returns {{dif: [number,number,number], min: [number,number,number]}} | ||
*/ | ||
const colorBound = ([maxH, maxS, maxL], [minH, minS, minL]) => ({ | ||
min: [minH, minS, minL], | ||
dif: [maxH - minH, maxS - minS, maxL - minL] | ||
}); | ||
const Presets = { | ||
@@ -216,5 +165,3 @@ aqua: AQUA, | ||
exports.VIOLA = VIOLA; | ||
exports.presetToFlat = presetToFlat; | ||
exports.presetToLeap = presetToLeap; | ||
exports.randPreset = randPreset; | ||
exports.tapPresets = tapPresets; |
import { Palett } from '@palett/cards'; | ||
import { randBetw } from '@aryth/rand'; | ||
import { hexToHsl, hslToHex, hexToRgb } from '@palett/convert'; | ||
import { hexToHsl, hslToHex } from '@palett/convert'; | ||
import { toner } from '@palett/toner-hsl'; | ||
import { oneself } from '@ject/oneself'; | ||
import { Dye } from '@palett/dye'; | ||
import { STR } from '@typen/enum-data-types'; | ||
@@ -128,50 +125,2 @@ const AQUA = { | ||
/** | ||
* @param {Object} [preset] | ||
* @param {string} preset.na | ||
* @return {Function} | ||
*/ | ||
const presetToFlat = preset => { | ||
var _ref, _preset$na; | ||
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; | ||
}; | ||
/** | ||
* | ||
* @param {Object} [preset] | ||
* @param {string} preset.max | ||
* @param {string} preset.min | ||
* @return {?{dif: number[], min: number[]}} | ||
*/ | ||
const presetToLeap = preset => { | ||
if (!preset) return null; | ||
const { | ||
max, | ||
min | ||
} = preset; | ||
return colorBound(parseHsl(max), parseHsl(min)); | ||
}; | ||
/** | ||
* | ||
* @param max | ||
* @param min | ||
* @returns {{dif: [number,number,number], min: [number,number,number]}} | ||
*/ | ||
const colorBound = ([maxH, maxS, maxL], [minH, minS, minL]) => ({ | ||
min: [minH, minS, minL], | ||
dif: [maxH - minH, maxS - minS, maxL - minL] | ||
}); | ||
const Presets = { | ||
@@ -195,2 +144,2 @@ aqua: AQUA, | ||
export { AQUA, ATLAS, AURORA, AZURE, FRESH, INSTA, JUNGLE, LAVA, METRO, MOSS, OCEAN, PLANET, POME, Presets, SUBTLE, VIOLA, presetToFlat, presetToLeap, randPreset, tapPresets }; | ||
export { AQUA, ATLAS, AURORA, AZURE, FRESH, INSTA, JUNGLE, LAVA, METRO, MOSS, OCEAN, PLANET, POME, Presets, SUBTLE, VIOLA, randPreset, tapPresets }; |
{ | ||
"name": "@palett/presets", | ||
"version": "0.7.9", | ||
"version": "0.7.10", | ||
"description": "A color converter", | ||
@@ -20,6 +20,6 @@ "main": "dist/index.cjs.js", | ||
"@ject/oneself": "^0.0.12", | ||
"@palett/cards": "^0.7.9", | ||
"@palett/convert": "^0.7.9", | ||
"@palett/dye": "^0.7.9", | ||
"@palett/toner-hsl": "^0.7.9", | ||
"@palett/cards": "^0.7.10", | ||
"@palett/convert": "^0.7.10", | ||
"@palett/dye": "^0.7.10", | ||
"@palett/toner-hsl": "^0.7.10", | ||
"@typen/enum-data-types": "^0.1.16" | ||
@@ -48,3 +48,3 @@ }, | ||
"homepage": "https://github.com/hoyeungw/palett/presets#readme", | ||
"gitHead": "122d02cbfff85a82d703afb1ee1a30b38789cd02" | ||
"gitHead": "ddfad2a10d138a1f32f77faa7916bbc60c7e89cc" | ||
} |
9513
257
Updated@palett/cards@^0.7.10
Updated@palett/convert@^0.7.10
Updated@palett/dye@^0.7.10
Updated@palett/toner-hsl@^0.7.10