I am having an array in my javascript with rgb colors. Let's say it looks like this:
colors = ['(133,10,22)', '(33,33,33)', '(255,255,255)', '(1,1,1)'];
How can I sort this array so as to get the lightest color first and the darkest last? So at the end my array to look like this for example:
colors = ['(255,255,255)', '(133,10,22)', '(33,33,33)', '(1,1,1)'];
Is there any particular library someone needs to use, or it is like the biggest sum of r+g+b the lightest the color? Thanks in advance.