CSS Color scheme not updating properly

I have been trying to create color palettes for my Theme. Whenever I use the variables $primary, $secondary etc in the css customization for the theme it will always use the default color palette for some reason. Even though in my profile preferences I changed it to a different palette, it seems like its continuing to grab the colors from the default palette.

The only way I can get the accurate color palette the user picked is by using var(--secondary) or var(--primary) Is there any way to fix this??

I turned off cache on Cloudflare and purged it, as well as ctrl/shift + F5 to refresh without cache and I am still getting the same issue. Any help here?

See Updating themes and plugins to support automatic dark mode for details on why that is happening