Unless the family has said otherwise, wear something dark, simple and smart. Black, navy, grey and dark green are all fine. The aim is to look respectful without drawing attention.
If the family asks for colour
Some families ask guests to wear a favourite colour, a football shirt or something bright. Follow the request. It is part of how they want the person remembered.
Think about the weather and the walk
At crematoriums people often wait outside before the service and look at the flowers afterwards. At a cemetery you may stand at the graveside on wet grass. Bring a coat and an umbrella, and wear shoes you can walk in on gravel and grass.
Religious services
Some faiths have their own customs, such as covering your head or wearing white. If you are not sure, ask the family or the funeral director.