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

fix(border): fix flipped title colors in panel border #5553

Conversation

TomJGooding
Copy link
Contributor

@TomJGooding TomJGooding commented Feb 17, 2025

Revert the change to the color flipping logic for panel border titles.

The issue with the new method using Style(reverse=True) is that this will also flip any border title colors set with Textual CSS.

Fixes #5548.

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

Sorry, something went wrong.

Revert the change to the color flipping logic for `panel` border titles.

The issue with the new method using `Style(reverse=True)` is that this
will also flip any border title colors set with Textual CSS.

Fixes Textualize#5548.
@TomJGooding TomJGooding marked this pull request as ready for review February 17, 2025 22:33
Comment on lines +382 to +386
(
(base_label_background + label_color)
if label_color.a
else TRANSPARENT
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change effectively reverts to the original logic, which is necessary since the foreground/background is flipped for the panel border.

I wanted to flag this change in case there is something I've missed. While this did cause a couple of snapshot tests to fail, visually they looked identical.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's encouraging that no tests broke

The previous version added the border color, this version doesn't. I don't recall what, if anything, that was there for. I have a suspicion it is something to do with transparent borders. i.e. if the border color has alpha.

Copy link
Contributor Author

@TomJGooding TomJGooding Feb 18, 2025

Choose a reason for hiding this comment

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

Thanks for checking, I wasn't sure what the border color was there for either.

If the border title actually only sits on the border color for the panel/tab styles, maybe this isn't needed....?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wish I could go back in time and ask myself why I did that. If I didn't write a test for it, then it's probably safe.

Comment on lines +382 to +386
(
(base_label_background + label_color)
if label_color.a
else TRANSPARENT
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's encouraging that no tests broke

The previous version added the border color, this version doesn't. I don't recall what, if anything, that was there for. I have a suspicion it is something to do with transparent borders. i.e. if the border color has alpha.

@willmcgugan
Copy link
Collaborator

Thanks

@willmcgugan willmcgugan merged commit 855bec6 into Textualize:main Feb 19, 2025
21 of 22 checks passed
@TomJGooding TomJGooding deleted the fix-border-fix-flipped-title-colors-in-panel-border branch February 20, 2025 10:30
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

Successfully merging this pull request may close these issues.

Border Title Color TCSS Style Regression
2 participants