Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions src/lightning/pytorch/callbacks/progress/rich_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,43 @@ class RichProgressBarTheme:

"""

description: Union[str, Style] = "white"
progress_bar: Union[str, Style] = "#6206E0"
progress_bar_finished: Union[str, Style] = "#6206E0"
progress_bar_pulse: Union[str, Style] = "#6206E0"
batch_progress: Union[str, Style] = "white"
time: Union[str, Style] = "grey54"
processing_speed: Union[str, Style] = "grey70"
metrics: Union[str, Style] = "white"
metrics_text_delimiter: str = " "
metrics_format: str = ".3f"
@staticmethod
def detect_color_system() -> str:
console = Console()
return console.color_system
Comment on lines +211 to +214
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we make this a proper function?
Is this the recommended way how users should implement their themes with rich?


color_system = detect_color_system.__func__()

# Default colors for each color system
default_colors = {
"truecolor": {
"progress_bar": "bright_blue",
"time": "bright_cyan",
"processing_speed": "bright_yellow",
},
"256": {
"progress_bar": "color51",
"time": "color45",
"processing_speed": "color227",
},
"default": {
"progress_bar": "blue",
"time": "cyan",
"processing_speed": "yellow",
},
}

# Apply specific colors based on the detected color system
colors = default_colors.get(color_system, default_colors["default"])

description: Union[str, Style] = "default"
progress_bar: Union[str, Style] = colors["progress_bar"]
progress_bar_finished: Union[str, Style] = colors["progress_bar"]
progress_bar_pulse: Union[str, Style] = colors["progress_bar"]
batch_progress: Union[str, Style] = "default"
time: Union[str, Style] = colors["time"]
processing_speed: Union[str, Style] = colors["processing_speed"]
metrics: Union[str, Style] = "default"


class RichProgressBar(ProgressBar):
Expand Down