I think I have sorted it out, purely by chance. I removed all the examples in the Your Code section of Code, and the border started to display the correct colour. I am not sure if that may have made the game behave differently in other areas as well.
