@palett/convert
Advanced tools
Comparing version 0.8.7 to 0.8.8
@@ -10,2 +10,7 @@ 'use strict'; | ||
function hexAt(tx, i) { | ||
let n = tx.charCodeAt(i); | ||
return n >> 5 <= 1 ? n & 0xf : (n & 0x7) + 9; | ||
} | ||
const prolif = n => n << 4 | n; | ||
function dil6(hex) { | ||
@@ -47,3 +52,2 @@ const hi = hex.length; | ||
}; | ||
const hue = (r, g, b, max, dif) => { | ||
@@ -88,8 +92,2 @@ if (dif === 0) return 0; | ||
function hexAt(tx, i) { | ||
let n = tx.codePointAt(i); | ||
return n >> 5 <= 1 ? n & 0xf : (n & 0x7) + 9; | ||
} | ||
const dual = n => n << 4 | n; | ||
/** | ||
@@ -100,3 +98,2 @@ * @param {string} hex | ||
function hexToInt(hex) { | ||
@@ -117,3 +114,3 @@ let lo = 0, | ||
if (hi === 3) { | ||
return dual(hexAt(hex, lo++)) << 16 | dual(hexAt(hex, lo++)) << 8 | dual(hexAt(hex, lo++)); | ||
return prolif(hexAt(hex, lo++)) << 16 | prolif(hexAt(hex, lo++)) << 8 | prolif(hexAt(hex, lo++)); | ||
} | ||
@@ -223,3 +220,3 @@ | ||
const intToHex = int => '#' + int.toString(16).toUpperCase().padStart(6, '0'); | ||
const intToHex = int => '#' + dil6(int.toString(16)); | ||
@@ -226,0 +223,0 @@ var _class, _temp, _class2, _temp2, _class3, _temp3, _class4, _temp4; |
@@ -6,2 +6,7 @@ import { round } from '@aryth/math'; | ||
function hexAt(tx, i) { | ||
let n = tx.charCodeAt(i); | ||
return n >> 5 <= 1 ? n & 0xf : (n & 0x7) + 9; | ||
} | ||
const prolif = n => n << 4 | n; | ||
function dil6(hex) { | ||
@@ -43,3 +48,2 @@ const hi = hex.length; | ||
}; | ||
const hue = (r, g, b, max, dif) => { | ||
@@ -84,8 +88,2 @@ if (dif === 0) return 0; | ||
function hexAt(tx, i) { | ||
let n = tx.codePointAt(i); | ||
return n >> 5 <= 1 ? n & 0xf : (n & 0x7) + 9; | ||
} | ||
const dual = n => n << 4 | n; | ||
/** | ||
@@ -96,3 +94,2 @@ * @param {string} hex | ||
function hexToInt(hex) { | ||
@@ -113,3 +110,3 @@ let lo = 0, | ||
if (hi === 3) { | ||
return dual(hexAt(hex, lo++)) << 16 | dual(hexAt(hex, lo++)) << 8 | dual(hexAt(hex, lo++)); | ||
return prolif(hexAt(hex, lo++)) << 16 | prolif(hexAt(hex, lo++)) << 8 | prolif(hexAt(hex, lo++)); | ||
} | ||
@@ -219,3 +216,3 @@ | ||
const intToHex = int => '#' + int.toString(16).toUpperCase().padStart(6, '0'); | ||
const intToHex = int => '#' + dil6(int.toString(16)); | ||
@@ -222,0 +219,0 @@ var _class, _temp, _class2, _temp2, _class3, _temp3, _class4, _temp4; |
{ | ||
"name": "@palett/convert", | ||
"version": "0.8.7", | ||
"version": "0.8.8", | ||
"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": "7101afaabbf033957fe713f45621423d6c08ffae" | ||
"gitHead": "34b716e675ffe0d0866df519cbfa62a46679f089" | ||
} |
13549