I am working on a Svelte project where I fetch color values from a backend service in a +page.svelte file. I have a customtheme.ts file where I have logic to enrich one color into 9 shades to get all the Tailwind color shades.
I am trying to use these fetched colors to dynamically change the default colors in customtheme.ts and then export them to the Tailwind config file. However, I am unable to retrieve these values using either 'context' or 'store'. Every time I try this, I get the following error:
[plugin:vite:css] [postcss] Function called outside component initialization
I have tried using setContext and onMount in the +page.svelte file to change the default colors in customtheme.ts, but the component did not mount due to the error mentioned above.
How can I resolve this issue and successfully use the fetched colors to dynamically change the Tailwind CSS colors?