Add function for calculating percentages for display.

Also bits and pieces of theme_tb and angle_x.