You can eat the brown avocado safely, but most people think it looks and tastes not as good as the fresh green avocado.
What is the trick to keeping them green?
Air. You need to keep oxygen from them. There are a number of ways you can do this. You can seal the avocado in a bag or tupperware (you can suck the air out of a bag, you can wrap it in cling-wrap (not all though, because some lets air through), you can coat it with olive oil or lemon juice, you can leave the pit in, and you can place it in a tupperware with onions (chopped up).
Olive oil works well, plastic bag not as well. But the lemon and onion techniques work even better. You can also put onion or lemon into guacamole dip to keep that fresher as well.