Understand the concept of colours history - keyboard shortcut X

Hi,
I need understand how the keyboard shortcut X → colour history (the last 5 colours) works and how I can describe it to an eventual feature in GIMP. Someone can help me to define in the development language this feature of MyPaint?
Thanks

MyPaint's community forums is sponsored by Altispeed. Click here to visit their website.