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

Add a percentage to the border definition to apply an alpha #1863

Closed
willmcgugan opened this issue Feb 23, 2023 · 3 comments · Fixed by #1954
Closed

Add a percentage to the border definition to apply an alpha #1863

willmcgugan opened this issue Feb 23, 2023 · 3 comments · Fixed by #1954
Assignees
Labels
enhancement New feature or request Task

Comments

@willmcgugan
Copy link
Collaborator

It's often a requirement to set a border that is muted a little, but there is no easy way of applying an alpha to a border if it is not already set.

I think we should add an optional percentage to the border definition, to multiple the borders alpha. Something like the following:

border: solid $foreground 50%;
@rodrigogiraoserrao
Copy link
Contributor

Just to make sure, you can mute the border a little if you bake the alpha value into the colour itself, right?

@willmcgugan
Copy link
Collaborator Author

Yeah, you can set a color with alpha. But you apply new alpha to that color.

@davep davep self-assigned this Mar 2, 2023
@davep davep added enhancement New feature or request Task labels Mar 2, 2023
davep added a commit to davep/textual that referenced this issue Mar 6, 2023
@davep davep linked a pull request Mar 6, 2023 that will close this issue
willmcgugan pushed a commit that referenced this issue Mar 7, 2023
* Allow setting an additional alpha on a border

See #1863.

* Update the ChangeLog

* Add snapshot tests for the border alpha value

* Extend the border snapshot tests

While this doesn't test *every* permutation, it covers enough bases that if
something were to change it should catch it.

* Tweak a typo in the border style examples

* Add border transparency percentage to the border docs

* Add a CSS example for using border transparency

* Add Color.multiply_alpha

* Update the CHANGELOG

* Multiply the alpha on a colour rather than replace it

As requested in
#1954 (review)

(actually required while talking in person with Will, but noted in the
above)

* Multiply the alpha on a border colour rather than replace it

As requested in
#1954 (review)

(actually requested while talking in person with Will, but noted in the
above)
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants