# Sort array of colors

**URL:** <https://forum.kirupa.com/t/sort-array-of-colors/316762>\
**Category:** flash\
**Created:** [December 1, 2010, 10:50pm UTC](https://forum.kirupa.com/t/sort-array-of-colors/316762 "2010-12-01T22:50:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![infect](https://avatars.discourse-cdn.com/v4/letter/i/c6cbf5/32.png) [@infect](https://forum.kirupa.com/u/infect)\
**Post date:** [December 1, 2010, 10:50pm UTC](https://forum.kirupa.com/t/sort-array-of-colors/316762/1 "2010-12-01T22:50:28Z")

</div>

I have an array of colors that i want to sort from light to dark. currently I am reading them in as uints and sorting the array decending using colors.sort(Array.DESCENDING); It almost works the way I want it to but there are always a couple of dark colors mixed in with lighter ones( black in a range of yellows for example). Anyone know of a good way to compare rgb values?

Thanks
