Search code examples
syntax-highlightingnotepad++

In Notepad++, set background color for file type


When various files types are open at the same time, such as .html, .css and regular .txt files in Notepad++, is it possible to have a different main background color for each file type?

Whenever I change the background color for any theme, language type, Default styles and of course, the Global Override, all in Style Configurator, each and every document tab and type reflects the background color change.

Each language has its own set of color specifiers in the Style Configurator. The text color and syntax highlighting colors seem to remain intact, but the main background color seems to be a global one size fits all affair?

What if I want text files to always be white background with black text but all .html files to be a black background with white text - and have each open at the same time?

I've spent WAAAAY too much time with intelligent trial and error and research. Perhaps I'm trying to do the impossible?


Solution

  • You can't do this on a per-file basis at all.

    You can do this on a per-language basis, but there is no language-level override (the "DEFAULT" color entry does not count) like there is for an application-level override (the "Global Override" entry). This means you have to set the same background color manually in all the individual color entries for a given language. It also means if you want to change the background color... you have to change it for all the individual entries for the language.

    In addition, since Notepad++ uses a language-based syntax highlighter, this means if you have an internal style sheet within an HTML file and you have different background colors for HTML and for CSS, you'll see two background colors within the same file. There is no way to specify a different color scheme for CSS or JavaScript that is embedded within HTML.