mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Updated Dark Mode
Added fusion dark palette.
This commit is contained in:
parent
58e16e29b0
commit
610b37413e
@ -28,6 +28,9 @@ import psutil
|
|||||||
import getpass
|
import getpass
|
||||||
from PySide2 import QtCore, QtWidgets, QtGui
|
from PySide2 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
|
from PySide2.QtCore import Slot,Qt
|
||||||
|
from PySide2.QtGui import QPalette, QColor
|
||||||
|
|
||||||
from onionshare_cli.common import Common
|
from onionshare_cli.common import Common
|
||||||
from onionshare_cli.settings import Settings
|
from onionshare_cli.settings import Settings
|
||||||
|
|
||||||
@ -48,8 +51,12 @@ class Application(QtWidgets.QApplication):
|
|||||||
QtWidgets.QApplication.__init__(self, sys.argv)
|
QtWidgets.QApplication.__init__(self, sys.argv)
|
||||||
|
|
||||||
# Check color mode on starting the app
|
# Check color mode on starting the app
|
||||||
# self.color_mode = self.get_color_mode()
|
|
||||||
self.color_mode = self.get_color_mode(common)
|
self.color_mode = self.get_color_mode(common)
|
||||||
|
|
||||||
|
# Enable Dark Theme
|
||||||
|
if self.color_mode == "dark":
|
||||||
|
self.setDarkMode()
|
||||||
|
|
||||||
self.installEventFilter(self)
|
self.installEventFilter(self)
|
||||||
|
|
||||||
def eventFilter(self, obj, event):
|
def eventFilter(self, obj, event):
|
||||||
@ -67,8 +74,26 @@ class Application(QtWidgets.QApplication):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def setDarkMode(self):
|
||||||
|
self.setStyle("Fusion")
|
||||||
|
dark_palette = QPalette()
|
||||||
|
dark_palette.setColor(QPalette.Window, QColor(53, 53, 53))
|
||||||
|
dark_palette.setColor(QPalette.WindowText, Qt.white)
|
||||||
|
dark_palette.setColor(QPalette.Base, QColor(25, 25, 25))
|
||||||
|
dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
|
||||||
|
dark_palette.setColor(QPalette.ToolTipBase, Qt.white)
|
||||||
|
dark_palette.setColor(QPalette.ToolTipText, Qt.white)
|
||||||
|
dark_palette.setColor(QPalette.Text, Qt.white)
|
||||||
|
dark_palette.setColor(QPalette.Button, QColor(53, 53, 53))
|
||||||
|
dark_palette.setColor(QPalette.ButtonText, Qt.white)
|
||||||
|
dark_palette.setColor(QPalette.BrightText, Qt.red)
|
||||||
|
dark_palette.setColor(QPalette.Link, QColor(42, 130, 218))
|
||||||
|
dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
|
||||||
|
dark_palette.setColor(QPalette.HighlightedText, Qt.black)
|
||||||
|
self.setPalette(dark_palette)
|
||||||
|
self.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }")
|
||||||
|
|
||||||
def get_color_mode(self, common):
|
def get_color_mode(self, common):
|
||||||
# return "dark" if self.is_dark_mode() else "light"
|
|
||||||
curr_settings = Settings(common)
|
curr_settings = Settings(common)
|
||||||
curr_settings.load()
|
curr_settings.load()
|
||||||
current_theme = curr_settings.get("theme")
|
current_theme = curr_settings.get("theme")
|
||||||
|
@ -89,7 +89,7 @@ class GuiCommon:
|
|||||||
new_tab_button_text_color = "#4e0d4e"
|
new_tab_button_text_color = "#4e0d4e"
|
||||||
if color_mode == "dark":
|
if color_mode == "dark":
|
||||||
header_color = "#F2F2F2"
|
header_color = "#F2F2F2"
|
||||||
# title_color = "#F2F2F2"
|
title_color = "#F2F2F2"
|
||||||
stop_button_color = "#C32F2F"
|
stop_button_color = "#C32F2F"
|
||||||
new_tab_button_background = "#5F5F5F"
|
new_tab_button_background = "#5F5F5F"
|
||||||
new_tab_button_border = "#878787"
|
new_tab_button_border = "#878787"
|
||||||
|
@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from PySide2 import QtCore, QtWidgets, QtGui
|
from PySide2 import QtCore, QtWidgets, QtGui
|
||||||
|
from PySide2.QtCore import Slot,Qt
|
||||||
|
from PySide2.QtGui import QPalette, QColor
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
import datetime
|
import datetime
|
||||||
|
Loading…
Reference in New Issue
Block a user