This is a simple javascript shenanigan which converts any given color to its grayscale counterpart. I built this just so I could compare both versions of the same color while drawing or doing artsy stuff. Especially while making pixel art, it is crucial to determine the luminosity index of each color so that you can lay the black and white pixels first and when the dull layout of the scene is ready, then you start to color it.
Just plain old Javascript
also tailwind
.
I used "luminosity" method to calculate the grayscale version of the picked color. But I also have the "average" method available to use as well.
grey = (red ร 0.3 + green ร 0.59 + blue ร 0.11)
average = (red + green + blue) รท 3
rgb(average, average, average) // see what we did here?
Both the methods can be seen in detail here