Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 21x 21x 21x 1x 1x 22x 1x 1x 1x 1x | export const isValidStyleColor = (color) => {
const style = new Option().style;
style.color = color;
return !!style.color;
};
export const getTranslucent = (color) => {
const colorIndex = color.split(",");
return colorIndex.length === 4 ? parseFloat(colorIndex.pop() || "") : 1;
};
export const matchRgba = (color) =>
color.match(
/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/
);
export const getRgba = (color, opacity) => {
const match = matchRgba(color);
Iif (!match) {
return color;
}
return `rgba(${Number(match[1])}, ${Number(match[2])}, ${Number(
match[3]
)}, ${opacity !== undefined ? opacity : Number(match[4])})`;
};
|