UNPKG

@nexara/nativeflow

Version:

Beautiful, responsive, and customizable UI components for React Native – built for performance and seamless experiences.

86 lines (85 loc) 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getChipColors = void 0; var _color = _interopRequireDefault(require("color")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const getBorderColor = ({ theme, strokeColor, disabled, active }) => { if (disabled) { return theme.colors.border.strong; } else if (strokeColor) { return strokeColor; } else if (active) { return (0, _color.default)(theme.colors.brand.primary).alpha(0.3).rgb().toString(); } return theme.colors.border.default; }; const getTextColor = ({ theme, labelColor, disabled }) => { if (disabled) { return theme.colors.typography.disabled; } else if (labelColor) { return labelColor; } return theme.colors.typography.secondary; }; const getBgColor = ({ theme, bg, disabled, active }) => { if (disabled) { return theme.colors.states.disabled; } else if (bg) { return bg; } else if (active) { return (0, _color.default)(theme.colors.brand.primary).alpha(0.1).rgb().toString(); } return 'transparent'; // return theme.colors.background.default // return Color(theme.colors.brand.primary).alpha(0.2).rgb().toString(); // return Color(theme.colors.brand.primary).alpha(0.1).rgb().toString(); }; const getChipColors = ({ theme, bg, labelColor, strokeColor, disabled, active }) => { const backgroundColor = getBgColor({ theme, bg, disabled, active }); const buttonTextColor = getTextColor({ theme, labelColor, disabled }); const buttonBorderColor = getBorderColor({ theme, strokeColor, disabled, active }); return { backgroundColor, buttonTextColor, buttonBorderColor }; }; exports.getChipColors = getChipColors; //# sourceMappingURL=utils.js.map