@palett/convert
Advanced tools
Comparing version 0.8.10 to 0.8.11
@@ -15,2 +15,15 @@ 'use strict'; | ||
const prolif = n => n << 4 | n; | ||
function dil2(hex) { | ||
const hi = hex.length; | ||
if (hi >= 2) return hex; | ||
if (hi === 1) return '0' + hex; | ||
if (hi <= 0) return '00'; | ||
} | ||
function dil3(hex) { | ||
const hi = hex.length; | ||
if (hi >= 3) return hex; | ||
if (hi === 2) return '0' + hex; | ||
if (hi === 1) return '00' + hex; | ||
if (hi <= 0) return '000'; | ||
} | ||
function dil6(hex) { | ||
@@ -241,2 +254,6 @@ const hi = hex.length; | ||
exports.Conv = Conv; | ||
exports.dil2 = dil2; | ||
exports.dil3 = dil3; | ||
exports.dil6 = dil6; | ||
exports.hexAt = hexAt; | ||
exports.hexToHsl = hexToHsl; | ||
@@ -243,0 +260,0 @@ exports.hexToInt = hexToInt; |
@@ -11,2 +11,15 @@ import { round } from '@aryth/math'; | ||
const prolif = n => n << 4 | n; | ||
function dil2(hex) { | ||
const hi = hex.length; | ||
if (hi >= 2) return hex; | ||
if (hi === 1) return '0' + hex; | ||
if (hi <= 0) return '00'; | ||
} | ||
function dil3(hex) { | ||
const hi = hex.length; | ||
if (hi >= 3) return hex; | ||
if (hi === 2) return '0' + hex; | ||
if (hi === 1) return '00' + hex; | ||
if (hi <= 0) return '000'; | ||
} | ||
function dil6(hex) { | ||
@@ -236,2 +249,2 @@ const hi = hex.length; | ||
export { Conv, hexToHsl, hexToInt, hexToRgb, hexToShort, hslToHex, hslToInt, hslToRgb, intToHex, intToHsl, intToRgb, rgbToHex, rgbToHsl, rgbToInt }; | ||
export { Conv, dil2, dil3, dil6, hexAt, hexToHsl, hexToInt, hexToRgb, hexToShort, hslToHex, hslToInt, hslToRgb, intToHex, intToHsl, intToRgb, rgbToHex, rgbToHsl, rgbToInt }; |
{ | ||
"name": "@palett/convert", | ||
"version": "0.8.10", | ||
"version": "0.8.11", | ||
"description": "A color converter among RGB, HEX and HSL.", | ||
@@ -44,3 +44,3 @@ "main": "dist/index.cjs.js", | ||
"homepage": "https://github.com/hoyeungw/palett/rgb#readme", | ||
"gitHead": "23423f1e548d18e7eff091a2e016fd76659c2e5c" | ||
"gitHead": "bf9059789864afece98e0ae653e7bd55531e134b" | ||
} |
15064
441