mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-11-06 20:42:15 +00:00
wip: basic theming support
This commit is contained in:
43
ui/theme/shared.py
Normal file
43
ui/theme/shared.py
Normal file
@ -0,0 +1,43 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Literal, TypedDict
|
||||
|
||||
from PySide6.QtGui import QColor, QPalette
|
||||
|
||||
|
||||
class _TCustomPalette(TypedDict):
|
||||
primary: QColor
|
||||
success: QColor
|
||||
error: QColor
|
||||
|
||||
|
||||
_TScheme = Literal["light", "dark"]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ThemeInfo:
|
||||
series: str
|
||||
name: str
|
||||
scheme: _TScheme
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash((self.series, self.name, self.scheme))
|
||||
|
||||
|
||||
class ThemeImpl:
|
||||
DEFAULT_CUSTOM_PALETTE = {
|
||||
"primary": QColor.fromString("#616161"),
|
||||
"success": QColor.fromString("#616161"),
|
||||
"error": QColor.fromString("#616161"),
|
||||
}
|
||||
|
||||
@property
|
||||
def info(self) -> ThemeInfo:
|
||||
return ThemeInfo(series="placeholder", name="placeholder", scheme="dark")
|
||||
|
||||
@property
|
||||
def qPalette(self) -> QPalette:
|
||||
return QPalette()
|
||||
|
||||
@property
|
||||
def customPalette(self) -> _TCustomPalette:
|
||||
return self.DEFAULT_CUSTOM_PALETTE # pyright: ignore[reportReturnType]
|
||||
Reference in New Issue
Block a user