styles.py

UI Styles System - Visual Style Definitions and State Management

LOCATION: lunaengine/ui/styles.py

DESCRIPTION:
Provides foundational style definitions and UI state management for visual elements.
Defines the basic structure for UI styling with support for different element states
(normal, hovered, pressed, disabled) and theme application.

KEY COMPONENTS:
- UIState: Enumeration of possible UI element interaction states
- UIStyle: Individual style definition with colors, fonts, and padding
- Theme: Complete theme collection with styles for all UI element types

LIBRARIES USED:
- typing: For type hints and dictionary annotations
- enum: For UI state enumeration

USAGE:
>>> style = UIStyle()
>>> color = style.get_color(UIState.HOVERED)
>>> theme = Theme()  # Creates default theme with all element styles

This module serves as the foundation for the more comprehensive theming system
in themes.py, providing basic style management capabilities.

class UIState

Description

Enumeration of possible UI element states.

Attributes
NORMAL: Any = 'normal'
HOVERED: Any = 'hovered'
PRESSED: Any = 'pressed'
DISABLED: Any = 'disabled'
Methods

No methods defined.

class UIStyle

Description

Defines the visual style for UI elements.

Methods
def __init__(self: Any) -> Any
Initialize a UI style with default values.
def get_color(self: Any, state: UIState) -> Tuple[int, int, int]
Get the color for a specific UI state.

Args:
   state (UIState): The UI state to get color for.
   
Returns:
   Tuple[int, int, int]: RGB color tuple for the specified state.

class Theme

Description

Collection of styles for different UI elements forming a complete theme.

Methods
def __init__(self: Any) -> Any
Initialize a theme with default styles for all UI elements.
Back to Ui Module