Sublime Forum

No color showing for just one file

#1

Hello, I’ve just started using Sublime Text 3 to do Python and Go coding. I’m loving the program so far. I’ve run into one head scratcher though. This file…

from random import randint
from asciimatics.screen import Screen

def demo(screen):
    while True:
        screen.print_at('Hello world!',
                        randint(0, screen.width), randint(0, screen.height),
                        colour=randint(0, screen.colours - 1),
                        bg=randint(0, screen.colours - 1))
        ev = screen.get_key()
        if ev in (ord('Q'), ord('q')):
            return
        screen.refresh()

Screen.wrapper(demo)

Just refuses to display with syntax coloring. The background is being set according to the associated .tmtheme file but the text is all gray. The code itself is valid python - it runs from the command line correctly.

I’ve got another python file file sitting in another tab, full of lovely colors. What on earth is going on?

Thanks,
Carl

0 Likes

#2

It is saved with a .py extension, BTW. In case anyone was wondering!

0 Likes

#3

I’ve sorted the problem. I had to use the command palette to select set syntax Python. I think the problem originated in the fact that when I created the file I initially forgot the .py extension, despite adding it straight away and before I pasted any code in. I’d call this a bug, in that renaming a file does not appear to update the associated syntax. I don’t know if this is a ST problem or a SidebarEnhancements bug.

0 Likes