1 | import { BlurTint } from './BlurView.types';
|
2 |
|
3 | export default function getBackgroundColor(intensity: number, tint: BlurTint): string {
|
4 | const opacity = intensity / 100;
|
5 | switch (tint) {
|
6 | case 'dark':
|
7 | // From apple.com
|
8 | return `rgba(28,28,28,${opacity * 0.65})`;
|
9 | case 'light':
|
10 | // From https://www.apple.com/newsroom
|
11 | return `rgba(255,255,255,${opacity * 0.7})`;
|
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 | }
|