[Tex/LaTex] How to set a dark theme in TeXworks

texworks

I am trying to set a dark theme in TeXworks.
This is similar to the question
"How can I set a dark theme in TeXstudio?",
but with the IDE TeXworks instead of TeXstudio.

The output should look similar to the following:

enter image description here

(Of course, it should look like TeXworks rather than TeXstudio.)

Is what I am asking possible?

Best Answer

I managed to figure this out by combining answers from two sources.

First, I found a post on the topic "Customize Editor Colors". The author of the post explains that you should create a custom style sheet mystyle.css using CSS mark-up, with the contents:

QTextEdit {
    background-color: black;  
    color: white;            /* sets the main text color */
}

When you run TeXworks from the command line, with the optional argument telling TeXworks to use that CSS file,

> texworks -stylesheet /pathto/mystyle.css

then the TeXworks editor shows white text on a black background:

enter image description here

Normally, I start TeXworks by clicking on a button on the Windows taskbar. I can edit the button/shortcut so that TeXworks loads the CSS file when it starts up as follows:

  1. Shift + right click on the button
  2. Click Properties
  3. Change

    "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\miktex-texworks.exe"
    

    to

    "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\miktex-texworks.exe" -stylesheet C:\Users\myusername\black-background.css
    
  4. Click OK