UNPKG

@oxyhq/services

Version:

OxyHQ Expo/React Native SDK — UI components, screens, and native features

50 lines (49 loc) 1.24 kB
"use strict"; import colorUtil from 'color'; const getUnderlayColor = ({ theme, calculatedRippleColor, underlayColor }) => { if (underlayColor != null) { return underlayColor; } if (theme.isV3) { return typeof calculatedRippleColor === 'string' ? calculatedRippleColor : '#000000'; } return colorUtil(typeof calculatedRippleColor === 'string' ? calculatedRippleColor : '#000000').fade(0.5).rgb().string(); }; const getRippleColor = ({ theme, rippleColor }) => { if (rippleColor) { return rippleColor; } if (theme.isV3) { return colorUtil(theme.colors.onSurface).alpha(0.12).rgb().string(); } if (theme.dark) { return colorUtil(theme.colors.onSurface || theme.colors.text || '#000000').alpha(0.32).rgb().string(); } return colorUtil(theme.colors.text || theme.colors.onSurface || '#000000').alpha(0.2).rgb().string(); }; export const getTouchableRippleColors = ({ theme, rippleColor, underlayColor }) => { const calculatedRippleColor = getRippleColor({ theme, rippleColor }); return { calculatedRippleColor, calculatedUnderlayColor: getUnderlayColor({ theme, calculatedRippleColor, underlayColor }) }; }; //# sourceMappingURL=utils.js.map