If your text message is blue, it means that you are communicating with another Apple device user through iMessage. If it is green, it means that you are texting with a non-Apple device user using the SMS/MMS protocol. Here are a few reasons why your text message could switch between blue and green:
1. iMessage is turned off: If your iMessage is turned off, then your messages will only be sent via SMS/MMS, which causes the bubbles to turn green. Turning iMessage back on will revert your text bubbles to blue.
2. Poor internet connection: If your internet connection is poor, iMessage may not send your text as an iMessage, resulting in the green bubbles.
3. Contact's device is not an Apple device: If the person you're texting does not have an Apple device, then your messages will always be sent as SMS/MMS and appear as green bubbles.
4. iMessage is not available in your country: iMessage is only available in certain countries. If it is not available in your country, then your messages will always be sent as SMS/MMS and appear as green bubbles.
5. The recipient's iMessage is turned off: If the person you're messaging has iMessage turned off, then your messages will be sent as SMS/MMS and appear as green bubbles.
It's essential to check all of these factors to determine why your text messages may switch between blue and green.