Skip to content

Commit 3cf6aba

Browse files
Added dark/light mode to preview window
- Closed #77 - Preview window now changes background and text colour based on the user's dark/light mode setting.
1 parent 100affc commit 3cf6aba

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Encryptext.pyw

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,23 @@ font_scale_factor = settings["otherSettings"]["fontScaleFactor"]
108108
"""
109109
Custom Classes
110110
"""
111-
css_styles = """body { background-color: white; }
111+
if settings["otherSettings"]["theme"] == "light":
112+
bg = "white"
113+
text = "black"
114+
code_bg = "#f8f8f8"
115+
else:
116+
bg = "black"
117+
text = "white"
118+
code_bg = "#080808"
119+
120+
css_styles = """body { background-color:""" + bg + """; color:""" + text + """;}
112121
pre { line-height: 125%; }
113122
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
114123
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
115124
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
116125
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
117126
.codehilite .hll { background-color: #ffffcc }
118-
.codehilite { background: #f8f8f8; }
127+
.codehilite { background: """ + code_bg + """; }
119128
.codehilite .c { color: #3D7B7B; font-style: italic } /* Comment */
120129
.codehilite .err { border: 1px solid #FF0000 } /* Error */
121130
.codehilite .k { color: #008000; font-weight: bold } /* Keyword */

0 commit comments

Comments
 (0)