Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed _has_alpha_channel function to work with hex and tuple colors#27463

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

raunak-sood2003
Copy link

@raunak-sood2003raunak-sood2003 commentedDec 7, 2023
edited
Loading

PR summary

This PR fixes bug#27321. The _has_alpha_channel function didn't work for hex strings and tuples because it just checked for decimal strings of length 4 (RGBA). The new implementation cases on the three different possible inputs (decimal, hex, and tuple) and determines if the input is a valid color that has an alpha channel. For checking hex colors, the function checks if all the symbols are hex values (0-9, A-F), and if the string is the correct length. Since hex values can be represented with the prefix "#" or "0x", the input strings have to be of length 9 or 10 (prefix + 4 bytes or 8 hex values for all channels).

PR checklist

Note

This PR doesn't pass the MyPy Stubtest, but passes all of the others. I'm not entirely sure how to get it to pass that, although it doesn't seem like too big of an error.

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

@raunak-sood2003 Thank you for your willingness to contribute!As stated the issue has already another pull request. Maybe we've been too terse in communication there, but this means, you should not open a competing PR. In particular, thediscussion there suggests that we may want to completely get rid of_has_alpha_channel().

I'm putting this on hold until#27327 is decided. Then, we'll see whether this here is still relevant and we'll either pick up here or close.

@timhoffm
Copy link
Member

I'm closing this in favor or the prior PR#27327.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@timhoffmtimhoffmtimhoffm requested changes

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@raunak-sood2003@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp