You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS captures an element in Display P3 when it is on screen and in sRGB when it is partly off it #281
On iOS, screen.screenshot(element) captures an element that is fully on screen with captureScreenshotWithBounds: (drawViewHierarchyInRect:) and one that is partly off screen with captureScreenshotOfView: (renderInContext:), both in packages/ui/ios/ViewQueryHelper.mm and both through a UIGraphicsImageRendererFormat left at its default range. On the E2E workflow's iPhone 17 Pro simulator the first comes out as a 16-bit PNG tagged Display P3 (iCCPkCGColorSpaceDisplayP3, cICP primaries 12) and the second as an 8-bit sRGB PNG. toMatchImageSnapshot compares raw values with pngjs, which ignores the profile, so one colour gets two values depending on where the element sits: the playground's orange is 242,169,59 in ios/orange-square-element-only.png and 255,165,0 in ios/out-of-bounds.png.
I expected every capture in one colour space, for example both renderers set to format.preferredRange = UIGraphicsImageRendererFormatRangeStandard.
Run the playground's ui/screenshot.harness.tsx and ui/out-of-bounds.harness.tsx with the ios runner, so they write __image_snapshots__/ios/orange-square-element-only.png (the orange square, fully on screen) and ios/out-of-bounds.png (a 1000 dp row, partly off screen). The two files linked above are the E2E workflow's captures, which fix(bridge): fail a missing image snapshot in CI mode instead of writing it #249 commits.
Look at their chunks: the first is 16-bit with an iCCP Display P3 profile and a cICP chunk, the second 8-bit with an sRGB chunk.
Read an orange pixel with pngjs (PNG.sync.read): 242,169,59 at (37, 150) of the first, 255,165,0 at (1650, 150), the sixth square, of the second.
Activity
fix(ui): capture iOS screenshots in 8-bit sRGB on every path (callsta…