I think it depends who died... I went to the funeral of a high school friend who played in rock and roll bands, and we wore the t-shirts of bands he had been in and jeans.
We had a dixieland band at my mother's funeral service, and the ladies from her jazz society wore their fancy roaring 20's fringe and sequined flapper dresses to her service becaused they loved her. I wore pink.
I got married on the beach at our home, and made sure to be clear that everyone should dress for the beach, in shorts, sandals and/or whatever would be comfortable for them. It would have been out of place and uncomfortable had anyone showed up in heels only to try to stand on sand, and find there was nowhere appropriate to sit on the beach in a dress.
I dress according to the situation, but there is a lot more depth to it than that. There's being sloppy when it's out of place, and then there's flexibility that fits the person involved.
That's the key to dealing with weddings, bar mitzvah's etc. Make it clear in the invitation what you expect of the people you invite to the event.