Take element height into consideration in colorize function

The colorise function now takes the element height into consideration
when animating, which makes the animation look as intended when the
switch is customised.