Repository navigation
Conversation
…idation (#1821) Three fixes by @mmporong, from #1812, #1813 and #1814: - Line#contains() checks the segment endpoints as well as collinearity; a point on the line beyond either endpoint was reported as contained - Color#parseHex() keeps the exact alpha byte of #RRGGBBAA / #RGBA colours instead of rounding it to one decimal (#0000FF01 was fully transparent); toHex8() output is unchanged, and every hex alpha round-trips - isPowerOfTwo() rejects zero, negative and fractional values, and is correct beyond the 32-bit range Co-authored-by: mmporong <mmporong@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JnzwA4xBNBw7cEZzG1bUru
|
Thank you, @mmporong! This fix is now on One follow-up commit in #1821 keeps I'm closing this one since #1821 merged it. Thanks again, especially for the thorough round-trip tests. Generated by Claude Code |
Description
Hex colors with alpha were rounded to one decimal when parsed, so values such as
#0000FF01became fully transparent and most 8-bit alpha values could not round-trip.toHex8()also truncated float alpha values instead of rounding them to the nearest byte.This change preserves the full alpha value from 4- and 8-digit hex colors and rounds alpha when serializing to
#RRGGBBAA. Regression coverage checks every 8-bit alpha value, every 4-bit shorthand alpha, low alpha, andrgba()serialization.Type of change
Checklist
pnpm lintpasses)pnpm testpasses)pnpm build)The focused Chromium suite passes all 126 color tests. The complete browser suite was not run locally.
Related issues
None.