UNPKG

ipink-util

Version:

util.js

13 lines (10 loc) 415 B
import { TinyColor } from '../node_modules/.pnpm/@ctrl_tinycolor@4.1.0/node_modules/@ctrl/tinycolor/dist/module/index.mjs'; const getColorObj = (color) => { return new TinyColor(color); }; const getOpacityColor = (color, opacity) => { const colorInfo = getColorObj(color); if (!colorInfo.isValid) return color; return colorInfo.setAlpha(opacity).toRgbString(); }; export { getColorObj, getOpacityColor };