daisyui icon indicating copy to clipboard operation
daisyui copied to clipboard

Inefficient Color Generator Code

Open sphinxrave opened this issue 3 years ago โ€ข 1 comments

Weird looping behavior at https://github.com/saadeghi/daisyui/blob/66ee475b0297fe56c5cef5867e1c83ef9dc6d5cb/src/colors/functions.js#L19

The foreach shouldn't be looping over the primary-focus, secondary-focus etc etc generators. It should just operate on the list of colors provided, and then the generators should fill in the non-provided colors in one go.

It's fine as a preprocessor step, but, well, the only reason I care is that I'm trying to use that function at runtime and noticing it is incredibly expensive.

sphinxrave avatar Jun 11 '22 18:06 sphinxrave

As you can see, there are different functions and variables being used for each color name, so it can't be one function to use a list of color names.
But if you have a more efficient solution, PRs are welcome.

saadeghi avatar Jun 12 '22 00:06 saadeghi