Repository navigation
remotion: Round fractional rgb() channels in interpolateColors() - #12912
Merged
samohovets merged 1 commit intoNov 3, 2026
Merged
Conversation
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Round fractional
rgb()/rgba()channels —parse255inpackages/core/src/interpolate-colors.ts:143now usesMath.round(Number.parseFloat(str))instead ofNumber.parseInt(str, 10), sorgb(127.6, 0, 0)yieldsrgb(128, 0, 0)like browsers. Clamping to 0-255 is unchanged, andparse255is only reached by the legacy comma-separatedrgb/rgbamatchers. - Regression test —
packages/core/src/test/interpolateColors.test.ts:144covers rounding up (127.6,254.5), a tie (0.5), and rounding down (127.4).
Verification notes
- The rounding direction matches the CSS Color 4 spec: sRGB components "must be rounded towards +∞, not truncated" (
Math.roundis round-half-toward-+∞ for positive values). - Verified locally:
bun test src/testfrompackages/corepasses (740 pass, 0 fail), andoxfmt --checkpasses on both changed files. parse255is module-private, and a repo-wide search found no other fractionalrgb()/rgba()literals, so the behavior change is isolated.
deepseek-v4.1-flash | 𝕏
Member
|
Thanks! |
This branch was successfully deployed
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.

interpolateColors()parsedrgb()/rgba()channels withNumber.parseInt, so fractional channels were truncated instead of rounded. Browsers round them (rgb(127.6, 0, 0)renders asrgb(128, 0, 0)), butinterpolateColors()returnedrgba(127, 0, 0, 1), one level darker. For example,rgb(127.6, 0.5, 254.5)becamergba(127, 0, 254, 1)instead ofrgba(128, 1, 255, 1). This shows up when anrgb()string is built from computed values.parse255now rounds the parsed float (ties go up, like CSS) before clamping. The existing clamping to 0-255 is unchanged.Test:
RGB > rgb rounds fractional channelsinpackages/core/src/test/interpolateColors.test.ts. It fails onmain(Received: "rgba(127, 0, 254, 1)") and passes with the fix. All 41 tests in the file pass withbun test(1.4.2). I ran it outside the package, without the happy-dom preload, because I didn't do a fullbun install.prettier --check(3.8.1) passes on both files. I did not runturbo run lintor the other packages' tests.AI-assisted: I used an AI coding assistant to find and fix this, then reviewed the change and ran the tests myself.