Sort Tags by Color

A question asked in GitHub how to sort tags by color? So

  1. open
  2. create a tiddler with below script
<$list filter="[all[tiddlers]tags[]!is[system]] :sort::reverse[{!!color}]">
<div class="tc-menu-list-item" style="margin-bottom:4px">
<<tag>>
</div>
</$list>

NOTE: This code works if the tiddler has a color field!

Thank you for the help.

But how do I sort the tags by color within the drop-down list when assigning tags to a new tiddler (see image)?
Do I have to insert your code into a specific location to achieve the same result in the drop-down list?

Ah, you want to overwrite the core tiddler! I mean you gonna to change the default behavior of tag drop down! Lets see other people what say! I myself rarely change the core tids!