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

Derive Default for Color, TriColor and OctColor #225

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

liclac
Copy link
Contributor

@liclac liclac commented Dec 13, 2024

This matches BinaryColor in embedded-graphics.

While I don't think anyone should particularly be relying on the output of Color::default(), the embedded-text crate has a trait bound of C: PixelColor + Default, which it uses it when "resetting" a style - just to have something to temporarily set the text colour to, presumably with the assumption that if it's being reset, it's about to be set to something sensible again in a moment.

https://github.com/embedded-graphics/embedded-text/blob/ea5271d32512eeed7a6caadf09509ff5d2447c63/src/rendering/line.rs#L24-L42

Given BinaryColor already has a similar behaviour, I figure this seems like a simple enough trait bound to simply satisfy like this. This patch is currently being successfully used in one of my own projects.

This matches BinaryColor in `embedded-graphics`, and is required by the
`embedded-text` crate.
@auto-assign auto-assign bot requested a review from caemor December 13, 2024 13:40
@maor1993
Copy link

Hey, I ran into the same issue trying to used the embedded-text crate, hopefully this will be merged quickly 🙏🏾

@caemor
Copy link
Owner

caemor commented Dec 16, 2024

Makes sense. Thanks for the PR.

@caemor caemor merged commit 1edb243 into caemor:main Dec 16, 2024
2 checks passed
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.

3 participants