Application wide updates for dark mode support including dark canvas option and better colors

This commit is contained in:
Ali Khalil
2022-04-17 22:41:02 +03:00
parent adad500f15
commit 5cc869c1fd
93 changed files with 690 additions and 567 deletions

View File

@@ -82,7 +82,18 @@ class CanvasCache(QtCore.QObject):
self.axes.set_xticks([])
self.axes.set_yticks([])
if self.app.options['global_theme'] == 'white':
settings = QtCore.QSettings("Open Source", "FlatCAM")
if settings.contains("theme"):
theme = settings.value('theme', type=str)
else:
theme = 'light'
if settings.contains("dark_canvas"):
dark_canvas = settings.value('dark_canvas', type=bool)
else:
dark_canvas = True
if theme == 'light' and not dark_canvas:
self.axes.set_facecolor('#FFFFFF')
else:
self.axes.set_facecolor('#000000')
@@ -154,7 +165,7 @@ class PlotCanvasLegacy(QtCore.QObject):
self.app = app
if self.app.options['global_theme'] == 'white':
if self.app.options['global_theme'] == 'light':
theme_color = '#FFFFFF'
tick_color = '#000000'
self.rect_hud_color = '#0000FF10'
@@ -639,7 +650,7 @@ class PlotCanvasLegacy(QtCore.QObject):
if self.app.options["global_cursor_color_enabled"]:
color = self.app.options["global_cursor_color"]
else:
if self.app.options['global_theme'] == 'white':
if self.app.options['global_theme'] == 'light':
color = '#000000'
else:
color = '#FFFFFF'
@@ -694,7 +705,7 @@ class PlotCanvasLegacy(QtCore.QObject):
if color:
color = color
else:
if self.app.options['global_theme'] == 'white':
if self.app.options['global_theme'] == 'light':
color = '#000000'
else:
color = '#FFFFFF'
@@ -737,7 +748,7 @@ class PlotCanvasLegacy(QtCore.QObject):
self.canvas.blit(self.axes.bbox)
def clear_cursor(self, state):
if self.app.options['global_theme'] == 'white':
if self.app.options['global_theme'] == 'light':
color = '#000000'
else:
color = '#FFFFFF'