diff --git a/CHANGELOG.md b/CHANGELOG.md index 439fd56f6..a3e84657f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added Widget._refresh_scroll to avoid expensive layout when scrolling https://github.com/Textualize/textual/pull/1524 - `events.Paste` now bubbles https://github.com/Textualize/textual/issues/1434 - Improved error message when style flag `none` is mixed with other flags (e.g., when setting `text-style`) https://github.com/Textualize/textual/issues/1420 +- Clock color in the `Header` widget now matches the header color https://github.com/Textualize/textual/issues/1459 ### Fixed diff --git a/src/textual/cli/tools/diagnose.py b/src/textual/cli/tools/diagnose.py index 447d21f95..4b6803a05 100644 --- a/src/textual/cli/tools/diagnose.py +++ b/src/textual/cli/tools/diagnose.py @@ -3,8 +3,10 @@ import os import sys import platform +from typing import Any +from functools import singledispatch from importlib_metadata import version -from rich.console import Console +from rich.console import Console, ConsoleDimensions def _section(title: str, values: dict[str, str]) -> None: @@ -55,7 +57,11 @@ def _os() -> None: def _guess_term() -> str: - """Try and guess which terminal is being used.""" + """Try and guess which terminal is being used. + + Returns: + str: The best guess at the name of the terminal. + """ # First obvious place to look is in $TERM_PROGRAM. term_program = os.environ.get("TERM_PROGRAM") @@ -111,11 +117,29 @@ def _term() -> None: ) +@singledispatch +def _str_rich(value: Any) -> str: + """Convert a rich console option to a string. + + Args: + value (Any): The value to convert to a string. + + Returns: + str: The string version of the value for output + """ + return str(value) + + +@_str_rich.register +def _(value: ConsoleDimensions) -> str: + return f"width={value.width}, height={value.height}" + + def _console() -> None: """Print The Rich console options.""" _section( "Rich Console options", - {k: str(v) for k, v in Console().options.__dict__.items()}, + {k: _str_rich(v) for k, v in Console().options.__dict__.items()}, ) diff --git a/src/textual/widgets/_header.py b/src/textual/widgets/_header.py index 66e4d4fe0..197601481 100644 --- a/src/textual/widgets/_header.py +++ b/src/textual/widgets/_header.py @@ -45,7 +45,7 @@ class HeaderClock(HeaderClockSpace): DEFAULT_CSS = """ HeaderClock { - background: $secondary-background-lighten-1; + background: $foreground-darken-1 5%; color: $text; text-opacity: 85%; content-align: center middle; @@ -97,7 +97,7 @@ class Header(Widget): } Header.-tall { height: 3; - } + } """ tall = Reactive(False)