import sys from PySide6.QtCore import QCoreApplication, Qt from PySide6.QtGui import QColor, QPalette from PySide6.QtWidgets import QApplication, QStyleFactory from bedit.gui.main_window import MainWindow def apply_light_theme(app: QApplication) -> None: """Use a predictable light Qt theme, independent of the desktop theme.""" app.setStyle(QStyleFactory.create("Fusion")) palette = QPalette() palette.setColor(QPalette.ColorRole.Window, QColor(240, 240, 240)) palette.setColor(QPalette.ColorRole.WindowText, Qt.GlobalColor.black) palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.white) palette.setColor(QPalette.ColorRole.AlternateBase, QColor(233, 233, 233)) palette.setColor(QPalette.ColorRole.ToolTipBase, Qt.GlobalColor.white) palette.setColor(QPalette.ColorRole.ToolTipText, Qt.GlobalColor.black) palette.setColor(QPalette.ColorRole.Text, Qt.GlobalColor.black) palette.setColor(QPalette.ColorRole.Button, QColor(240, 240, 240)) palette.setColor(QPalette.ColorRole.ButtonText, Qt.GlobalColor.black) palette.setColor(QPalette.ColorRole.BrightText, Qt.GlobalColor.red) palette.setColor(QPalette.ColorRole.Link, QColor(0, 102, 204)) palette.setColor(QPalette.ColorRole.Highlight, QColor(0, 120, 215)) palette.setColor(QPalette.ColorRole.HighlightedText, Qt.GlobalColor.white) palette.setColor( QPalette.ColorGroup.Disabled, QPalette.ColorRole.Text, QColor(109, 109, 109), ) palette.setColor( QPalette.ColorGroup.Disabled, QPalette.ColorRole.ButtonText, QColor(109, 109, 109), ) app.setPalette(palette) def main() -> int: QCoreApplication.setApplicationName("BEdit") QCoreApplication.setOrganizationName("BEdit") QCoreApplication.setApplicationVersion("0.1.0") app = QApplication(sys.argv) app.setApplicationDisplayName("BEdit") apply_light_theme(app) window = MainWindow() window.show() return app.exec()