Repository navigation
fix(mobile): derive syntax palette from color scheme, not background hex - #6188
Conversation
Surface: the mobile app (apps/mobile). Surface: the mobile app (apps/mobile), iOS and Android. Area: dark mode and theming (no hardcoded colors). # Problem Three renderers decide which reference palette to paint by comparing a theme token to a hardcoded hex literal instead of reading the color scheme: - `apps/mobile/src/components/agents/code-block.tsx:120` — `const isDark = colors.background === '#0E0E10';` - `apps/mobile/src/components/pr-review/diff/diff-line.tsx:100` — `const isDark = colors.background === '#0E0E10';` - `apps/mobile/src/components/pr-review/diff/pr-diff-side-by-side-row.tsx:208` — `const isDark = colors.background === '#0E0E10';` The value is then passed to `tokenColorFor(className, isDark)` and to the `MUTED_COLOR` selection in `apps/mobile/src/lib/pr-review/diff/syntax-colors.ts` (which only has `light`/`dark` entries). The app's real dark signal is `useColorScheme()` in `apps/mobile/src/lib/hooks/use-theme-colors.ts` (`colorScheme === 'dark' ? darkColors : lightColors`), and other renderers already use it (`skeleton.tsx`, `markdown-text.tsx`, `markdown-table.tsx`). `darkColors.background` happens to be `'#0E0E10'` in `apps/mobile/src/lib/hooks/theme-colors.generated.ts` (generated from `src/global.css`), so the comparison is a coincidental equality: any change to that generated token silently flips code blocks and diff lines to the light syntax palette on a dark surface, producing an unreadable, wrong-theme diff. # Requested behavior - Determine l
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryAll three production sites now derive Verification notes:
Files Reviewed (8 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
|
(bot) ## Live proof (proof-only request; no code change) Ran on android; the request asked for android. This request asked for live proof of existing behaviour. There is no diff; the verify round ran the must-run scenarios and recorded the evidence below.
|
|
(bot) The live proof for this request is in the pull request description, under "## E2E proof". This comment previously carried the capture paths on the machine that took them, so every image 404'd. Evidence now goes in the description, where the upload rewrites each reference. |
![[e1] kwf-fix proof-1bf7811 / PR 6188 — code block and PR-review diff render in light and dark on android — e2e-mobile-app/pr-side-dark.png](https://private-user-images.githubusercontent.com/4062236/652564086-439ee00a-c518-4f3a-97e2-7c60bd022b36.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTIxNjQzOTMsIm5iZiI6MTc5MjE2NDA5MywicGF0aCI6Ii80MDYyMjM2LzY1MjU2NDA4Ni00MzllZTAwYS1jNTE4LTRmM2EtOTdlMi03YzYwYmQwMjJiMzYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTAxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjEwMTZUMTUyMTMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Yzg1MzI2Y2QwOTZlZDMzNzFiMTYwNGY4Y2Q1Y2E4ODY5NGMxNmQzNjdjYWFkN2EzZmQ2ZTk1OWI0MGU1NzMyNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.4VzlAsnvLKEe7opB7ryUjZHzCW7pcULBUq6Z_1qa1-s)
![[e1] kwf-fix proof-1bf7811 / PR 6188 — code block and PR-review diff render in light and dark on android — e2e-mobile-app/pr-dark.png](https://private-user-images.githubusercontent.com/4062236/652564100-c1189e1c-e76a-47e9-b6a3-d244ce96d6c8.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTIxNjQzOTMsIm5iZiI6MTc5MjE2NDA5MywicGF0aCI6Ii80MDYyMjM2LzY1MjU2NDEwMC1jMTE4OWUxYy1lNzZhLTQ3ZTktYjZhMy1kMjQ0Y2U5NmQ2YzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTAxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjEwMTZUMTUyMTMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2Q0ZmE4YzlmODQ2MThmMDMxNGRiZjBiNjdmZWIyYWM4NDMyZmNlMDk4ZjEwYzc1YWVlNDRjZmUzNjRmYjRlMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.PtQbetVU3yNW2SZfipAqoK_vC5i_LDXVCciffn1v9Ps)
Changelog for users
Changelog for maintainers
code-block.tsx,diff-line.tsx, andpr-diff-side-by-side-row.tsxnow usesuseColorScheme() === 'dark'instead of thecolors.background === '#0E0E10'equality.syntax-colors.tsvalues,src/global.css, andtheme-colors.generated.tsare untouched, and no dependency was added.isDarksites first; they are the only production change.code-block.test.ts,diff-line.mounted.test.tsx, andpr-diff-side-by-side-row.mounted.test.tsxassert the dark palette underuseColorScheme() === 'dark'and the light palette under'light', comparing againsttokenColorForandMUTED_COLORrather than any hex literal.react-native(markdown-renderer.test.ts,tool-diff-preview.test.ts) now provideuseColorSchemebecause the components read it.useColorSchemein any test or host that mocksreact-native; a missing stub returns undefined and selects the light palette.languageso token runs are actually painted, and the code-block suite re-checks the palette on a later render.E2E proof
[e1] PR 6188 own scenarios on android: dark PR-review unified diff (e3), appearance flip with a diff on screen (e6), transcript code block (e1) — Live on android emulator-5554 from the pr-review state. e3-scene.log: 'SCENE e3 OK' then 'android.widget.Button Deleted line 68: version: '1.0.10',, tap to comment tappable [0,924][1080,982]' with 'Night mode: yes' (e3.png md5 f324966b16d0b4c60796987291193a21). e6-flip.log shows the same diff under '== set light =='/'Night mode: no' (e6-light.png md5 4a74c7d99a3a55b9953394b3098b1503) and under '== set dark =='/'Night mode: yes' (e6.png md5 f324966b16d0b4c60796987291193a21), so the same content repainted. e1-cloud-enter.log: 'session.sh: cloud-enter OK sid=ses_f5126a555fffSir2tNbx2eFsJe…
[e1] PR 6188 own scenarios on android: dark PR-review unified diff (e3), appearance flip with a diff on screen (e6), transcript code block (e1)
Open findings (not fixed here)
e6-flip.mp4
e6-flip.mp4.trim.mp4