Synced refresh rate of colourBox and colourText and refactored code

r? @ErnestWong