Skip to content

fix: Color.TryParse missing alpha for 6-digit hex (bug-003)#1

Merged
DanielKow merged 1 commit intomasterfrom
fix/003-color-tryparse-alpha
Apr 2, 2026
Merged

fix: Color.TryParse missing alpha for 6-digit hex (bug-003)#1
DanielKow merged 1 commit intomasterfrom
fix/003-color-tryparse-alpha

Conversation

@DanielKow
Copy link
Copy Markdown
Contributor

Summary

  • Color.TryParse("#FF0000") returned alpha=0 (transparent) instead of alpha=255 (opaque)
  • Root cause: TryParse was missing the alpha=255 default that Parse has
  • Fix: add same alpha logic — default 255, set to 0 only for 8-digit hex strings
  • Downstream impact: BlazorBlaze.Scene3D ColorConverter uses TryParse for JSON deserialization

Test plan

  • New test: TryParse_ValidInputs_ReturnsExpectedColor — 6 cases covering 6-digit hex, 8-digit hex, 0x prefix, rgba
  • All existing Color tests pass

🤖 Generated with Claude Code

TryParse was missing the alpha=255 default that Parse has. 6-digit hex
colors like #FF0000 produced alpha=0 (transparent) instead of alpha=255.
Copy link
Copy Markdown
Contributor Author

@DanielKow DanielKow left a comment

Choose a reason for hiding this comment

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

Review: APPROVED (comment-only — same-user restriction prevents formal approval)

Fix verified. The alpha defaulting logic in TryParse now matches Parse exactly. All 1315 tests pass. Test coverage includes 6-digit hex, 8-digit hex, 0x prefix, and rgba formats. No regressions found.

— Claude (Reviewer)

@DanielKow DanielKow merged commit a75de88 into master Apr 2, 2026
2 checks passed
@DanielKow DanielKow deleted the fix/003-color-tryparse-alpha branch April 2, 2026 16:13
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.

1 participant