feat(saju-ui-v2): _shell/helpers — hexA/daeunLabel/deriveTraits/colorMap + tests
This commit is contained in:
6
src/pages/saju/_shell/helpers/hexA.js
Normal file
6
src/pages/saju/_shell/helpers/hexA.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export default function hexA(hex, alpha) {
|
||||
const h = hex.replace('#', '');
|
||||
const expanded = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
|
||||
const n = parseInt(expanded, 16);
|
||||
return `rgba(${(n >> 16) & 255},${(n >> 8) & 255},${n & 255},${alpha})`;
|
||||
}
|
||||
Reference in New Issue
Block a user