> It uses two neural networks to predict the full palette. The first, model.js it predicts all the shades vertically from 50-900 given a certain color as input. The second, nextModel.js predicts horizontally all the colors horizontally given a certain shade as input.
It's not really a neural network either.
It will always return the same output for the same input. There are no training datasets etc.
It's literally just an algorithm that returns an output and returns the next output based on the previous output.
I would have expected some dataset of colors to train a model on and then use that to generate values but there really is no actual AI.
People seem to confuse a clever algorithm with AI.
There's nothing inherently intelligent about what it does. It's all math.
"AI" may seem cheesy, but you have to remember that in the future, lots of "AI programming" is just going to become "programming." This is clearly an effective, simple way of solving the problem, and requires no clever or common algorithms.
Also, what the hell is this file? Haha. https://raw.githubusercontent.com/dmarman/dmarman.github.io/...
This is awesome. The model outputs were turned into a single line of javascript which then gets evaluated by multiplying the color against all the weights. That wasn't what I was expecting, and I'm totally stealing this technique.
I may be wrong, but it seems the weights of a trained NN
This is literally just the definition of a 1 layer neural network.
I think it's best to keep the palette separate from the code (e.g. store palettes in an app like Sip), and not insist on the replaceability of colors across a range. E.g. instead of blue-500 use functional names like btn-color or brand-color and alias the colors that way in code.
The key would be to spend an absurd amount of time carefully cataloguing good colors – by hand – and training it to extrapolate from that information. That's basically how the Musnell color system was created. https://en.wikipedia.org/wiki/Munsell_color_system It's the realization that color space isn't spherical, it's not a cube, it's not any shape at all except "how humans happened to evolve." Even the term "max chromaticity" is just a reflection of the weird way our brains happen to work, not an intrinsic property of color.
In that context, a universal curve fitting algorithm might be handy. Which of course is all that AI is.
It's a bit more nuanced than that. Not only do you need to catalog good colors (and color combinations), you need to have it done by a large number of people, since different people perceive color differently and have different aesthetic preferences. This is something I've been working on in the limited context of color cycles for data visualization and plotting [1][2]. Based on my preliminary analysis, these data are quite noisy.
[1] https://colorcyclesurvey.mpetroff.net/ [2] https://mpetroff.net/2020/01/color-cycle-survey-update/
They took the CIELUV/LCH/HCL solid and compressed it into a sphere, similar to HSL on top of RGB. The L* (perceptual luminance) value is consistent across hues, it can also replace the 100/200/300 scale for design systems.
But even the CIE model has flaws, chromacity is inherently linked with brightness/luminance, no color model can change that. A more saturated/chromatic color will always be perceived as more bright than a less chromatic one at the same luminance. And in order to create a palette you need normalization, which will always weed out individual color defining peaks.
What's the point of color variables, if they just describe the color they are... We already have color names for that.
It's the kind of thing professional designers do intentionally, but set up in a system that makes it easier to get a "designed" look without much effort.
The Tailwind UI updated color palette at https://www.npmjs.com/package/@tailwindcss/ui has true greys with no color hue.
And you don't need Tailwind UI to use the updated colors (I asked Adam once). I think the plan is the updated color palette will eventually be rolled into a future Tailwind CSS update, if not already.
"During early access, the components in Tailwind UI depend on some extensions we've added to the default Tailwind CSS config (like extra spacing values, updated, colors, additional shadows, etc.)
"These extensions will make their way into Tailwind itself in the future...."
The bottom of Tailwind UI documentation gives more info on the color palette changes, including the new grey:
https://tailwindui.com/documentation#how-tailwindcss-ui-exte...
https://tailwindcss.com/docs/customizing-colors#default-colo...
You can also create your own custom colors with whatever names you want, whether color names or something like "primary" as the primary color of your theme. For each you can set shades as well.
You don't want your model to mimic your trainning data. Otherwise, it would performe poorly with new data.