Change text color while writing
What you are looking for are Color Schemes, which automatically set the text color based on the context. Sublime supports them out of the box, see https://docs.sublimetext.io/guide/customization/color_schemes.html and https://www.sublimetext.com/docs/3/color_schemes.html.