UNPKG

@nexara/nativeflow

Version:

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

23 lines (22 loc) 756 B
"use strict"; const LightenColorShades = (color, amount) => { if (color.startsWith("#")) { color = color.slice(1); } if (color.length === 3) { color = color.split("").map(c => c + c).join(""); } if (color.length !== 6) { throw new Error("Invalid HEX color."); } const getValidColorValue = start => { const value = parseInt(color.slice(start, start + 2), 16); return Number.isNaN(value) ? 0 : Math.min(255, Math.max(0, value + amount)); }; const r = getValidColorValue(0); const g = getValidColorValue(2); const b = getValidColorValue(4); return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`; }; export default LightenColorShades; //# sourceMappingURL=LightenColorShades.js.map