Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds two new capabilities for handling RGB colors and LED eye patterns:
- Introduces
Rgb::invertto flip color channels. - Adds
Eye::percentagefor generating gradient steps based on a fraction. - Provides
Eye::invertto invert all LED eye colors.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/types/src/led.rs | Added percentage and invert methods on Eye for gradient and inversion behavior. |
| crates/types/src/color.rs | Implemented invert method on Rgb to invert color channels. |
Comments suppressed due to low confidence (3)
crates/types/src/led.rs:67
- Consider clamping or validating
fractionto the expected 0.0–1.0 range or using 0.0 directly instead off32::EPSILONto make the threshold logic clearer and avoid unexpected behavior for very small values.
color_at_0: if fraction > f32::EPSILON {
crates/types/src/led.rs:110
- Add a doc comment explaining the purpose of
invert, what it inverts (e.g., color channels), and any edge cases or expected input ranges.
pub fn invert(self) -> Self {
crates/types/src/color.rs:153
- Add unit tests covering
Rgb::invert(and alsoEye::invert/Eye::percentage) to verify correct behavior across edge cases such as black, white, and boundary fraction values.
pub fn invert(self) -> Self {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
11f62e2 to
8c1a840
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why? What?
Needed for #1931