Is there any specific API that help plugin to set text color?
No. The way Sublime Text colors text is exclusively through use of language grammar files, so the only way to change the text color is to load up a new grammar or a new color scheme.For workarounds, see e.g. github.com/a-sk/livecss.
It's quite helpful, thanks.