It's blue if sent to to an iPhone, iPad or iPod Touch and green if sent to a non-Apple phone. If Apple's iMessages server is down or the person has a poor Internet connection, it will fall back to sending it as a regular text message, which is green.