Repository navigation
fix(reader): draw Mushaf previews like the reader and keep page colors in dark mode - #1317
Merged
Merged
Conversation
QuranThemedImage.RenderingMode never changed anything: .tinted fell through to .invertInDarkMode, both returned no image, and every page got the same colorInvert() from invertThemedColorIfNeeded(). Drop the enum, the renderingMode parameters threaded through AdaptiveImageScrollView, the content views and the reading selector, the async image processing, Reading.usesInvertedQuranImageRenderingInDarkMode, and the now unused UIImage inverted()/tintedImageUsingFalseColorFilter helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plain colorInvert() turns green chrome pink, blue chrome orange and changes what tajweed colors mean. Rotate the hue by 180 degrees after inverting so colors keep their hue while lightness flips. Grays, and so monochrome pages, are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the reading to chrome style mapping and its palette from QuranImageFeature's LinePageChromeStyle to NoorUI's QuranPageChromeStyle, so line pages, full pages and the reading selector preview draw sura headers and ayah markers from one source. ImageDecorations carries the style and ImageDecorationsView resolves it with themeColorScheme, like the line pages. Full pages of the 1421 mushaf now use the green palette with filled markers instead of Color.pageMarkerTint ring-only markers, which is removed. SuraHeaderView and AyahNumberView keep explicit color initializers, and AyahNumberView gains one that takes a palette. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dark green sura header and ayah marker ring used #047857, the light mode color, which is dim on black and quiet backgrounds. Use #10B981 in dark mode. The other green and blue values stay the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quiet pages are dark even when the appearance mode is light, and invertThemedColorIfNeeded() already treats them that way. The chrome palette followed themeColorScheme alone, so a light appearance drew light marker fills with unreadable numbers on the quiet background. Pick the dark palette whenever the theme is quiet, for line pages, full pages and the reading selector previews. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 1439 and 1441 previews had the blue and green sura header frames and ayah markers baked into the PNG, so dark mode inverted them while the reader, which draws that chrome at runtime, kept its colors. Replace both samples with text-only versions (1441 from the shipping app's newer sample) and draw the headers and markers over them with SuraHeaderView and AyahNumberView in the reading's chrome palette, as the 1421 preview already does. Positions come from the removed chrome: header frames are sized like the reader's (1038/1080 of the page width, at the asset's aspect ratio) and markers use the reader's line-page size, now shared as LinePageGeometryEngine.ayahMarkerWidthRatio through a new ImageDecorations.ayahNumberWidthRatio. ReadingSelectorFeature gains a test target to keep the preview chrome complete and inside the sample. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every AyahNumberView caller passes a chrome palette, so keep only the palette initializer and always draw the filled marker. Also remove UIColor.adjustedBrightness(by:), which only the deleted false-color tinting used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Image inversion and ayah dimming checked colorScheme plus the quiet theme, while the chrome palette checked themeColorScheme plus the quiet theme. Add EnvironmentValues.quranPageColorScheme, dark for the quiet theme and otherwise themeColorScheme, the scheme the page background resolves with, and use it for all three. Views derive the chrome palette from that one value. Drop the redundant Equatable conformances on the chrome style and palette, and the palette tests that only restated its values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the test that re-derived the line-page preview positions; the remaining test still guards that every reading drawing chrome at runtime has a complete preview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ImageDecorations now takes the chrome style without a default and the ayah marker width ratio as an init parameter, from the new AyahMarkerWidthRatio constants shared with the line-page geometry. The reading selector preview passes the reading's own drawsAyahNumbersAndSuraHeaders, and ReadingSelectorFeature declares the QuranGeometry and QuranKit modules its sources import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build the 1439 and 1441 page 604 samples from the mushaf's own 15 line images, laid out by LinePageGeometryEngine with the reader's ContentLineLayoutBuilder input, instead of stripping chrome from old screenshots. The engine fills the existing 1080x1728 and 1440x2304 samples exactly. Take the preview's sura header and ayah marker positions from the same layout of each reading's ayahinfo database, rounded to whole pixels. 1439 headers become 110 px tall so SuraHeaderView fits their width, as in the reader. No position moved by more than 1 px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
In dark mode, the Mushaf picker previews for Madani 1441 and 1439 turned pink and orange, while the reader draws them green and blue. The previews were bundled screenshots with sura headers and ayah markers baked in, and dark mode inverts the whole image. This PR draws the previews the way the reader draws pages and tidies the page color handling around it.
LinePageGeometryEngine. Sura headers and ayah markers are drawn at runtime with the reader's views and colors, at positions computed from the reading's ayahinfo database.colorInvert()followed byhueRotation(180°), so 1440's blue and tajweed's green headers keep their colors, and tajweed rule colors keep their meaning in dark mode.QuranPageChromeStylein NoorUI is shared by line pages, 1421 full pages and the previews. 1421 moves frompageMarkerTintring-only markers to the green palette with filled markers. The dark green header and ring go from #047857 to #10B981.quranPageColorScheme). Before, Quiet with Light appearance drew 1439/1441 markers as light dots with unreadable numbers.QuranThemedImage.RenderingMode,Reading.usesInvertedQuranImageRenderingInDarkMode, the unused async tint/invert code,AyahNumberView's color initializer andUIColor.adjustedBrightness.The shipping app's copies of the two preview images need a matching update in quran-ios-private. That PR is up and should merge right after this one, together with a
Package.resolvedbump.Screenshots
Private app, no-sync build, iPhone 17 Pro simulator, page 604.
Test plan
make format-lintmake build-no-sync,make build-syncmake test-no-sync/test-syncfor NoorUITests and QuranImageFeatureTests;test-no-syncfor ReadingSelectorFeatureTests (new), QuranKitTests and QuranGeometryTestsmake build-example-no-sync🤖 Generated with Claude Code