1import { BlurTint } from './BlurView.types'; 2 3export default function getBackgroundColor(intensity: number, tint: BlurTint): string { 4 const opacity = intensity / 100; 5 switch (tint) { 6 case 'dark': 7 // From Apple iOS 14 Sketch Kit - https://developer.apple.com/design/resources/ 8 return `rgba(25,25,25,${opacity * 0.78})`; 9 case 'light': 10 // From Apple iOS 14 Sketch Kit - https://developer.apple.com/design/resources/ 11 return `rgba(249,249,249,${opacity * 0.78})`; 12 case 'default': 13 // From xcode composition 14 return `rgba(255,255,255,${opacity * 0.3})`; 15 } 16 throw new Error(`Unsupported tint provided: ${tint}`); 17} 18