Unable to change color of text strings in javascript files



  • In Notepad++ (version 6.8.7) I am unable to change the font color of my text strings in .js files. The file in the screenshot is saved with a .js extension. Other font colors work correctly, such as NUMBER and KEYWORD. And my font colorization works correctly in other file types, such as .html and .json. Is there a bug in the interpreter for .js files? Is there a way to make my .js to use the same color schemes as .html? (That would solve my problem - but if there’s a more orthodox approach, that would be ideal.)

    Important: I have enabled Global background color, but I have not enabled Global foreground color.

    see screenshot

    What am I doing wrong? (Thanks in advance for any help!)



  • @Nate-Jensen141

    don’t have that problem using npp 7.3.1

    Cheers
    Claudia



  • Thanks Claudia. I updated to NPP 7.3.2 and still had the same problem. But I was able to solve the problem. I had to go back to an old theme file that had the settings I like, put it in the right folder, and point to that. Then it worked. AND I was able to copy the theme section for javascript from my custom theme file over to stylers.xml, and that solved it also. But trying to change the javascript section of stylers.xml through the UI simple doesn’t work. Have you tried that?

    One very strange thing that is still baffling me though: My old theme file doesn’t have a language defined for JSON files, but the stylers.xml does. So json files weren’t showing up in my list of languages. I copied the json section over to my custom theme file, restarted NPP, but json still doesn’t show up. I went into Settings -> Preferences -> Languages and nothing I did in there had any effect at all. By best result was to copy my .js section from my custom theme back to stylers, and that works, and it works for json also.

    It seems like NPP really has some bugs in this regard. Things the UI clearly indicate can be customized actually does nothing in several respects. Am I doing something wrong?



  • @Nate-Jensen141

    Have you tried that?

    Yes, that’s what I did.
    Concerning the changes - I guess the reference is the default theme (styler.xml).
    If it does work with the default, then make sure that your theme has all the required
    entries for the language in question, as well. If this is the case, than it should work.
    From the current discussion I get the feeling that your styler.xml is already corrupted.
    Maybe you wanna think about replacing it with the stylers.model.xml which is the one
    which is used to create the styler.xml if you do a new installation.
    Of course, you can also run a compare of these files and do the changes manually.

    Cheers
    Claudia


Log in to reply