Atom Code Editor. Why is my code not in color?

Viewed 66292

I started using the Atom Code editor recently. During my last project, I installed a couple of tools to make my coding more interactive.

One of the features added color to my code which makes it easier to read.

However, I started a new project today and the code is all white on a dark background. How do I color my code?

I have attached two screenshots of the colored code and the non colored code just to illustrate what I mean but its pretty straightforward.

14 Answers

Use ctrl+shift+l to open the language selector, and select the auto-detect option.

I had the same problem. Try switching to HTML(Go) in the bottom right corner. It's between UTF-8 and Github.

The current version of Atom I'm running as of Oct 2018 seems to identify code by tags. So even if I select HTML manually, unless the file has <html> tag, it still doesn't mark it as HTML. I just add redundant commented out <!-- <html> --> tag in the beginning of the file and it does the trick.

Why isn't anybody mentioning the file extension?

Your "Project Greg.html" is HTML. But "Random Quote Machine" has NO extension.

This is why the syntax isn't showing.

Check the bottom right corner of the screen to make sure atom has the correct language/file extension selected

If your file has extension HTML or ejs (.html, .ejs) language-ejs package can 't recognize those file.In the bottom right corner of the screen, change the HTML to ejs or javascript, then the atom can recognize that the code your write is parts of ejs. NOte, you need to install language -ejs package first.

Follow the steps:-

  1. File->Settings
  2. Select 'Core' from left pane.
  3. Change color profile to "Use sRGB color profile".
  4. Restart 'Atom'.

Make sure the beginning identifies the file as a html document. I had this problem and just added <!DOCTYPE html> as the very first line and it worked.

Maybe this will helps for someone, but if you tab once this line: <!DOCTYPE html> and it will show coloured HTML code

If the langage set is already the right one,and the code stays grey unless you directly edit it, just try setting another langage then switch back. It worked for me after Atom refused to color an entire copy-pasted HTML page.

I am a very newbie but wanna share what worked for me. Please don't judge me strictly. Since I work only in Python, it is very convenient to change the grammar to Python every time. How to make it automatic:

  1. File->Settings (or use Ctrl+Comma)
  2. Click Open config folder
  3. Click on styles.less
  4. After all the code, write exactly this source.python {

}

  1. Save
  2. Restart Atom.
  3. You're all set.

Hope this was helpful, couldn't find this solution elsewhere.

The !DOCTYPE html did not change the color for me but in the bottom right is :

CRLF UTF-8 HTML GitHub Git(0) menu options. I selected HTML and in the popup window selected AUTO. The color returned instantly.

Related