Sublime Forum

How to get colorized text?

#1

So I just got sublime, and all the images I’ve seen have text colorized based on what the code is doing. My text is all one color. I’ve tried changing the theme, but all that does is change the background color and occasionally the text color, but it’s still all one color. What am I doing wrong?

0 Likes

#2

The color of the text is controlled primarily by the syntax of the file (the syntax decides what should be colored and the color scheme decides how it is colored), which generally is determined by the extension that the file has when you open it.

Newly created files are assigned the Plain Text syntax by default, which changes to the appropriate syntax when you save the file for the first time.

You can see what syntax Sublime thinks the file should be using by looking in the bottom right of the window in the status bar.

Ways to set the syntax to the appropriate one are:

  • Save the file for the first time with an extension appropriate to the type of file it is
  • Click on the currently displayed syntax in the status line to open a menu that allows you to select the syntax
  • Using View > Syntax from the menu (presents the same menu as above)
  • Using the command palette to find a command like Set Syntax: XXXX (where XXXX is the name of the syntax)

Assuming none of the above works or the syntax that your code is using is not displayed in that menu anywhere, you could be using a file type that Sublime doesn’t know about by default. In that case you can search https://packagecontrol.io/ to see if there is a third party package that provides the support you need.

3 Likes

New to Sublime Text and Coding - Syntax Colouring