With the new update a new button has appeared. It says "Sort inventory":
When you click it, items in your items will be reordered and colored, presumably based on what type are they according to the algorithm:
Items marked as favourite will be unaffected. However it's entirely unclear what order applies to items of the same type. I was hoping to sort all my potions by name. That's not what is applied, as you can see here:
So what are the precise rules for sorting items, their colors and order of the items of the same type? This is a new feature, I'm sure other people are also curious how does it work...