react-native-web-internals
Version:
React Native for Web
18 lines (17 loc) • 635 B
JavaScript
import isWebColor from "../isWebColor/index";
import { processColor } from "../processColor/index";
const normalizeColor = (color, opacity = 1) => {
if (color == null) return;
if (typeof color == "string" && isWebColor(color))
return color;
const colorInt = processColor(color);
if (colorInt != null) {
const r = colorInt >> 16 & 255, g = colorInt >> 8 & 255, b = colorInt & 255, alpha = ((colorInt >> 24 & 255) / 255 * opacity).toFixed(2);
return `rgba(${r},${g},${b},${alpha})`;
}
};
var normalizeColor_default = normalizeColor;
export {
normalizeColor_default as default
};
//# sourceMappingURL=index.js.map