Skip to content

Commit

Permalink
feat: Add toggleTheme function to enable light and dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
LyubomirT committed Jul 27, 2024
1 parent 97d7969 commit 43e0d04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def stop_typing(self):
self.thread.wait()
self.thread = None
self.typing_finished()

def toggleTheme(self):
if self.lightModeCheckBox.isChecked():
self.setStyleSheet(open("style.css").read())
else:
self.setStyleSheet(open("darkmode.css").read())

if __name__ == "__main__":
app = QApplication(sys.argv)
Expand Down
2 changes: 2 additions & 0 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def setupUi(self, MainWindow):

self.lightModeCheckBox = QtWidgets.QCheckBox(self.horizontalLayoutWidget)
self.lightModeCheckBox.setObjectName("lightModeCheckBox")
self.lightModeCheckBox.clicked.connect(self.toggleTheme)
self.lightModeCheckBox.setChecked(True)
self.settingsLayout.addWidget(self.lightModeCheckBox)

self.horizontalLayout.addLayout(self.settingsLayout)
Expand Down

0 comments on commit 43e0d04

Please sign in to comment.