UNPKG

react-native-web-internals

Version:

React Native for Web

18 lines (17 loc) 656 B
import isWebColor from "../isWebColor/index.mjs"; import { processColor } from "../processColor/index.mjs"; 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.mjs.map