The reader must want to read
As far as I'm concerned, this is the basis for nearly everything you put into a novel. If the reader doesn't want to read your book, he will usually stop. Everything, therefore, must focus first on making sure the reader wants to read your book.
The same logic applies to characters. The reader must want to read about the characters you create. This makes sense. The story is about someone, after all; it makes sense that the reader should want to follow that person's story. Following this logic, a very simple truth emerges:
Your reader must like your character
While plenty of authors would like to explore the dark side of people, the truth is that we - no matter what we think - do not want to read about evil people or characters. We do not sympathize with them or their motives. There's no connection. We want to read about people we understand, people we can look up to, people we like. Therefore, it makes sense that the reader should like your main character. And that gets difficult if they are evil (don't worry; I'm getting to gray characters).
That being said, there are plenty of novels which succeeded, which feature evil, depressing, or downright mean protagonists. How can these possibly work? This leads us to another simple truth:
The reader must see the light at the end of the tunnel
No matter how bad your protagonist is, as long as there is hope, some flicker of something better, the reader has something to hang onto. If you write about, say, a brutal murderer, but every time he kills he feels a shred - if only for a moment - of remorse, you still have a story. Granted, you have a job ahead of you, but there is a glimmer of hope. There is something to work with.
That is how you write evil characters, otherwise known as Dark Protagonists. So how do you write a gray protagonist?
If you think about it, the answer should be obvious: You know the reader must want to read about the character. You know for this to happen, the reader must care about the character. It's reasonable to assume that a morally gray character will do some good things, and some bad things. The reader will support the good things, but the truth is that any amount of bad always outweighs the good when evaluating someone in fiction.
So that leaves us dealing with the bad side of the character. However, we already know how to deal with bad or evil characters: give the reader something to hope for. In this case, a morally gray character will already have some good things pulling for him; simply make those things the light at the end of the tunnel. Give the reader hope that those parts of the character can win out over the bad. Give the character a struggle between the bad and the good within himself.
That's how you write a gray character: the same way you would write a dark character. Give the reader something to hope for, and play that up as much as you can.
If you have a gray or dark character who is not conflicted about his actions, or is actively trying to stomp out his good side with no second-thoughts, then you have a problem. You might think people want to read about such a person. Other readers might think so too. But I can guarantee, that when they actually start seeing the person how he really is, they will change their mind very, very quickly.
I hope this helps you. Best of luck in your endeavors!