UNPKG

@oxyhq/services

Version:

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

56 lines (55 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTouchableRippleColors = void 0; var _color = _interopRequireDefault(require("color")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const getUnderlayColor = ({ theme, calculatedRippleColor, underlayColor }) => { if (underlayColor != null) { return underlayColor; } if (theme.isV3) { return typeof calculatedRippleColor === 'string' ? calculatedRippleColor : '#000000'; } return (0, _color.default)(typeof calculatedRippleColor === 'string' ? calculatedRippleColor : '#000000').fade(0.5).rgb().string(); }; const getRippleColor = ({ theme, rippleColor }) => { if (rippleColor) { return rippleColor; } if (theme.isV3) { return (0, _color.default)(theme.colors.onSurface).alpha(0.12).rgb().string(); } if (theme.dark) { return (0, _color.default)(theme.colors.onSurface || theme.colors.text || '#000000').alpha(0.32).rgb().string(); } return (0, _color.default)(theme.colors.text || theme.colors.onSurface || '#000000').alpha(0.2).rgb().string(); }; const getTouchableRippleColors = ({ theme, rippleColor, underlayColor }) => { const calculatedRippleColor = getRippleColor({ theme, rippleColor }); return { calculatedRippleColor, calculatedUnderlayColor: getUnderlayColor({ theme, calculatedRippleColor, underlayColor }) }; }; exports.getTouchableRippleColors = getTouchableRippleColors; //# sourceMappingURL=utils.js.map