feat(config): Implement parsing for shader and window frame configurations
This commit is contained in:
19
src/theme.py
19
src/theme.py
@@ -268,6 +268,12 @@ _current_palette: str = "DPG Default"
|
||||
_current_font_path: str = ""
|
||||
_current_font_size: float = 14.0
|
||||
_current_scale: float = 1.0
|
||||
_shader_config: dict[str, Any] = {
|
||||
"crt": False,
|
||||
"bloom": False,
|
||||
"bg": "none",
|
||||
"custom_window_frame": False,
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------ public API
|
||||
|
||||
@@ -286,6 +292,14 @@ def get_current_font_size() -> float:
|
||||
def get_current_scale() -> float:
|
||||
return _current_scale
|
||||
|
||||
def get_shader_config(key: str) -> Any:
|
||||
"""Get a specific shader configuration value."""
|
||||
return _shader_config.get(key)
|
||||
|
||||
def get_window_frame_config() -> bool:
|
||||
"""Get the window frame configuration."""
|
||||
return _shader_config.get("custom_window_frame", False)
|
||||
|
||||
def get_palette_colours(name: str) -> dict[str, Any]:
|
||||
"""Return a copy of the colour dict for the named palette."""
|
||||
return dict(_PALETTES.get(name, {}))
|
||||
@@ -388,4 +402,9 @@ def load_from_config(config: dict[str, Any]) -> None:
|
||||
if font_path:
|
||||
apply_font(font_path, font_size)
|
||||
set_scale(scale)
|
||||
global _shader_config
|
||||
_shader_config["crt"] = t.get("shader_crt", False)
|
||||
_shader_config["bloom"] = t.get("shader_bloom", False)
|
||||
_shader_config["bg"] = t.get("shader_bg", "none")
|
||||
_shader_config["custom_window_frame"] = t.get("custom_window_frame", False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user