Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Border Panel & Tab Auto Contrast Color #5389

Open
ddkasa opened this issue Dec 13, 2024 · 2 comments
Open

Border Panel & Tab Auto Contrast Color #5389

ddkasa opened this issue Dec 13, 2024 · 2 comments

Comments

@ddkasa
Copy link
Contributor

ddkasa commented Dec 13, 2024

So I have been experimenting with some border panels and have been wondering if they should be contrasting the border color instead, as using the background for the auto-contrast can leave un-desired results and is inconsistent with auto-contrast color for generic text.

I have attached some screenshots in different themes to demonstrate the issue.

Screenshot from 2024-12-13 11-24-35
Screenshot from 2024-12-13 11-24-25
Screenshot from 2024-12-13 11-24-05
Screenshot from 2024-12-13 11-29-56

I understand the change is recent when the Tab style was added, so maybe this is intentional?

MRE

from textual.app import App
from textual.widgets import Static
from textual.containers import Container


class BugReportApp(App):
    CSS = """
    Container {
        border-title-color: auto;
        background: $panel;
        max-height: 2;
        width: 20;
        border: panel $surface-lighten-1;
        margin-bottom: 1;
    }

    Static {
        color: auto;
        content-align: center middle;
        background: $surface-lighten-1;
        height: 1;
        width: 15;
    }
    """

    def compose(self):
        c = Container()
        c.border_title = "Panel Title"
        yield c
        yield Static("Content")


if __name__ == "__main__":
    BugReportApp().run()

Textual Diagnostics

Versions

Name Value
Textual 1.0.0
Rich 13.9.4

Python

Name Value
Version 3.12.3
Implementation CPython
Compiler GCC 13.2.1 20240316 (Red Hat 13.2.1-7)
Executable /home/dk/tmp/textual-color-variable/.venv/bin/python

Operating System

Name Value
System Linux
Release 6.11.11-200.fc40.x86_64
Version #1 SMP PREEMPT_DYNAMIC Thu Dec 5 18:38:39 UTC 2024

Terminal

Name Value
Terminal Application Kitty
TERM xterm-kitty
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=137, height=54
legacy_windows False
min_width 1
max_width 137
is_terminal True
encoding utf-8
max_height 54
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@darrenburns
Copy link
Member

Yeah, there's some weirdness here. Simpler MRE:

from textual.app import App
from textual.widgets import Static
from textual.containers import Vertical


class BugReportApp(App[None]):
    CSS = """
    Vertical {
        border: tab #f0f0f0;
        background: black;
        border-title-color: auto;
    }
    """

    def compose(self):
        with Vertical() as c:
            c.border_title = "Panel Title"
            yield Static("Content")


if __name__ == "__main__":
    BugReportApp().run()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants