0

This question already has an answer here:

I want to change the color from white to black in Texworks. The output pdf remain white, I means the editor back ground.

enter image description here


I can do it !! Thank you for letting me know:

memorandum

1) Make a mystyle.css as follows and put it in the file which contains the texworks.exe. In my case such directory located in C:\texlive\2013\tlpkg\texworks

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

QWidget { /* everything, basically */
    background-color: #3A3A3A;
    color: white;
}

QPushButton { /* buttons */
    background-color: #646464;
    border-style: inset;
    border-width: 1.5pt;
    border-color: white;
    padding: 4px;
}

QPushButton:pressed { /* after you press the button */
    background-color: #818181;
}

QTableView {
   background-color: #424242;
   alternate-background-color: #424242;
   selection-background-color: #818181;
   font-color:#FFFFFF;
}

/* QComboBox refers to drop-down menus (such as when selecting pdfTeX, pdfLaTeX, XeTeX, etc.) */

QComboBox {
    border: 1px solid gray;
    padding: 1px 18px 1px 3px;
    border-radius: 4px;
}

QComboBox::drop-down { 
    subcontrol-origin: padding;
    subcontrol-position: top right;
    width: 15px;
    border-left-width: 1px;
    border-left-color: #EEEEEE;
    border-left-style: solid; /* just a single line */
}

QComboBox::down-arrow:on {
    top: 5px;
    left: 5px;
}

/* QMenuBar refers to the menu at the top (File, Edit, etc.)
   QMenu::item refers to the items under the menu
 */

QMenu::item:selected { /* when user selects item using mouse or keyboard */
    background-color: #909090;
}

QMenuBar::item:pressed,  QMenuBar::item:selected {
    background: #909090;
}

QTextEdit { /* text editor */
    background-color: black;  
    color: white; 
}

QScrollBar:vertical { /* vertical scroll bar */
    background: #424242;
    width: 10px;
    margin: 10px 0 10px 0;
}
QScrollBar::handle:vertical { /* the part of the scroll bar that gets dragged*/
    background: #AAAAAA;
    min-height: 20px;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { 
    /* this seems useless, but it is actually quite important- 
       it makes the scroll bar's background a uniform color instead
       of tiny dots, if it were removed. */
    background: none;
}

QScrollBar:horizontal { /* same thing, but horizontal */
    background: #424242;
    height: 10px;
    margin: 0 10px 0 10px;
}
QScrollBar::handle:horizontal { /* etc. */
    background: #AAAAAA;
    min-width: 20px;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { 
    background: none;
}

QTabBar::tab { /* tabs that lead to different displays (such as those under "Preferences") */
    background: #3A3A3A;
    border: #909090;
    padding: 2px 4px 6px 8px;
    /* now I can't remember how this padding works, but removing it leads to ugly tab designs*/
}

QTabBar::tab:hover {
    background: #818181;
}

QTabBar::tab:selected {
    background: #909090;
}

2) On the command prompt, move into a directory which contains texworks.exe.

In my case, to move such directory, I execute the code cd C:\texlive\2013\tlpkg\texworks in the Command prompt. Then the command prompt will be as follows; C:\texlive\2013\tlpkg\texworks>

3) To open the texworks reflecting the mystyle.css, execute the code TeXWorks -stylesheet=./mystyle.csson the command prompt on the directory explained 2).

In my case, in the command line will be the following :

C:\texlive\2013\tlpkg\texworks>TeXWorks -stylesheet=./mystyle.css

4) With an error about path launch, but the texworks open with black background.

5) Further more, by replacing the syntax-patterns.txt located in C:\Users\User\TeXworks\configuration (my case) with the following one, we can get more comfortable visual:

contents for new syntax-patterns.txt:

# Each entry consists of three whitespace-separated fields:

# <style> <spell?> <regex>



# <style> is a combination of color and style flags

# Valid syntax:

# <fgcolor>

# <fgcolor>/<bgcolor>

# ;<fontflags>

# <fgcolor>;<fontflags>

# <fgcolor>/<bgcolor>;<fontflags>

#

# The color fields <fgcolor> and <bgcolor> are either:

# *) a color name from the list defined in the SVG standard;

#    see http://www.w3.org/TR/SVG/types.html#ColorKeywords

# *) a hexadecimal color value of the form #rrggbb; note that if this is used at

#    the beginning of a line, a space " " must be added in front of it so the

#    line is not interpreted as a comment (e.g., " #aabbcc" instead of "#aabbcc")

#

# The <fontflags> field is a combination of the letters

# B (bold)

# I (italic)

# U (underlined)



# <spell> is a flag controlling whether this style is subject to spell-checking;

# "Y" or "y" for yes, "N" (or anything else, actually) for no.



# <regex> is the regular expression to match.



# Note that order of rules may be important if several rules could match at the same position;

# this is why the generic "control sequence" rule comes AFTER the specific \begin/\end one.



[LaTeX]

# special characters

# PURPLE

 #ae8ef0    N   [$#^_{}&] 



# LaTeX environments

# ORANGE

 #dc861f;I  N   \\(?:begin|end)\s*\{[^}]*\} 



# LaTeX packages

# PINK

 #ec4271;I  N   \\usepackage\s*(?:\[[^]]*\]\s*)?\{[^}]*\}



# control sequences

# LIGHTBLUE

 #5dd4ef    N   \\(?:[A-Za-z@]+|.) 



# comments

# DARKBROWN

 #797666;I  Y   %.* 



[ConTeXt]

# special characters

# PURPLE

 #ae8ef0    N   [$#^_{}&] 



# start/stop

# ORANGE

 #dc861f;I  N   \\(?:start|stop)[A-Za-z]+ 



# control sequences

# LIGHTBLUE

 #5dd4ef    N   \\(?:[A-Za-z@]+|.) 



# comments

# DARKBROWN

 #797666;I  Y   %.* 



# other possibilities to be added....

# [BibTeX]

# [Metapost]

# etc

6) To open by double click on the texworks.exe,

  1. shiht+right click on the texworks.exe
  2. Click property
  3. Change the path: In my case I changed from C:\texlive\2013\bin\win32\texworks.exe to C:\texlive\2013\bin\win32\texworks.exe -stylesheet=C:\texlive\2013\tlpkg\texworks/mystyle.css

    Then by double click on the texworks.exe instead terminal, we can open TeXworks reflected above color change.

If we open texworks.exe by its short cut button, then the procedure 6) is required for each short cut button instead of texworks.exe.

Ref: How can I set a dark theme in TeXworks?

The result is as follows:

enter image description here

marked as duplicate by Stefan Pinnow, Circumscribe, Tiuri, Sebastiano, Raaja Feb 10 at 20:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Possibly related? How can I set a dark theme in TeXworks? – leandriis Feb 10 at 10:55
  • 3
    What has your reference link to do with your question? The screenshot show TeXworks instead of TeXstudio. – TeXnician Feb 10 at 10:58
  • I am not sure where I should put the css file and how reflect it. To tell the truth I changed the color of backgraund in my old computer. I buy a new one, then I am not sure where should I put file. – Camford Oxbridge Feb 15 at 8:02

Browse other questions tagged or ask your own question.