Line data Source code
1 : # SPDX-FileCopyrightText: 2026 PairInteraction Developers 2 : # SPDX-License-Identifier: LGPL-3.0-or-later 3 1 : from __future__ import annotations 4 : 5 1 : from PySide6.QtGui import QColor, QGuiApplication, QPalette 6 : 7 : 8 1 : def build_application_palette() -> QPalette: 9 1 : palette = QGuiApplication.palette() 10 : 11 : # Main application surfaces. 12 : # - Window: main window background, toolbox content areas, toolbox container, 13 : # and informational outcome labels 14 : # - Button: sidebar-adjacent controls including plot toolbar buttons, 15 : # toolbox tabs, and regular push buttons 16 1 : palette.setColor(QPalette.ColorRole.Window, QColor("#f9fbfe")) 17 1 : palette.setColor(QPalette.ColorRole.Button, QColor("#dbe4ef")) 18 : 19 : # Default text on light surfaces. 20 : # - Text: toolbox page content and informational outcome labels 21 : # - WindowText: main window text and plot toolbar button text 22 : # - ButtonText: toolbox tab labels and regular push button text 23 : # - HighlightedText: text on selected toolbox tabs, pressed plot toolbar 24 : # buttons, pressed push buttons, and selected export menu items 25 1 : palette.setColor(QPalette.ColorRole.Text, QColor("#111828")) 26 1 : palette.setColor(QPalette.ColorRole.WindowText, QColor("#111828")) 27 1 : palette.setColor(QPalette.ColorRole.ButtonText, QColor("#111828")) 28 1 : palette.setColor(QPalette.ColorRole.HighlightedText, QColor("#111828")) 29 : 30 : # Accent colors for interactive controls. 31 : # - Highlight: selected toolbox tabs and selected export menu items 32 : # - Accent: pressed/checked plot toolbar buttons and pressed push buttons 33 1 : palette.setColor(QPalette.ColorRole.Highlight, QColor("#cad9f7")) 34 1 : palette.setColor(QPalette.ColorRole.Accent, QColor("#cad9f7")) 35 : 36 : # Text intended for dark chrome and emphasized controls. 37 : # Used for the status bar plus hovered and checked sidebar tool buttons. 38 1 : palette.setColor(QPalette.ColorRole.BrightText, QColor("#ffffff")) 39 : 40 : # Neutral support colors for borders, dark panels, and hover states. 41 : # - Midlight: hover fill for buttons and borders for the toolbox, 42 : # info/error labels 43 : # - Mid: sidebar tool button text and borders in their resting state 44 : # - Dark: status bar fill, sidebar toolbar background, and menu border 45 1 : palette.setColor(QPalette.ColorRole.Midlight, QColor("#cdd5e0")) 46 1 : palette.setColor(QPalette.ColorRole.Mid, QColor("#8a91a0")) 47 1 : palette.setColor(QPalette.ColorRole.Dark, QColor("#28354e")) 48 : 49 1 : return palette