Derive Default for Color, TriColor and OctColor #225
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This matches
BinaryColor
inembedded-graphics
.While I don't think anyone should particularly be relying on the output of
Color::default()
, theembedded-text
crate has a trait bound ofC: 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.