File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 11<script >
22 import { onMount } from ' svelte' ;
33 export let text = ' Badge' ;
4- export let color = ' #0073F4' ;
4+ export let color = getRandomHexColor ();
5+ function getRandomHexColor () {
6+ const letters = ' 0123456789ABCDEF' ;
7+ let color = ' #' ;
8+ for (let i = 0 ; i < 6 ; i++ ) {
9+ color += letters[Math .floor (Math .random () * 16 )];
10+ }
11+ return color;
12+ }
13+ let contrastedColor = ' ' ;
514
6-
7- let contrastedColor = ' ' ;
8-
9- onMount (async () => {
10- const fontColorContrast = (await import (' font-color-contrast' )).default ;
11- contrastedColor = fontColorContrast (color);
12- });
15+ onMount (async () => {
16+ const fontColorContrast = (await import (' font-color-contrast' )).default ;
17+ contrastedColor = fontColorContrast (color);
18+ });
1319 </script >
1420
1521
You can’t perform that action at this time.
0 commit comments