From 01921b90d68df33b1534315ba78b050280ddfb26 Mon Sep 17 00:00:00 2001 From: Luke Bradford Date: Tue, 11 Aug 2026 17:18:43 -0700 Subject: [PATCH] Read the list-marker color from MarkdownRenderConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `OrderedListView` colors its numerals with `config.orderedListStyle.textColor`, but `UnorderedListView` drew its bullet and its task-list checkbox with a literal `Color.Theme.Foreground.Primary.Primary450`. A host that themes the config therefore gets correctly-colored numerals and bundled-palette bullets in the same document, with no way to reach the latter — an `Image`'s own `foregroundStyle` can't be overridden by an ancestor. Both now read the same config property the ordered list already uses. This is a no-op for anyone on the default config: `defaultOrderedListStyle`'s `textColor` *is* `Primary450`, the exact literal being replaced. Only a host that has already overridden `orderedListStyle` sees a change, and that is the change it asked for. Verified by running the package's own `UnorderedListViewTests` before and after: byte-identical results. (Heads up for CI: on my machine those snapshot tests already fail at unmodified `main` — 10 reference mismatches under `macOS-standard-*` — so the comparison above is "same failures before and after", not "green". Looks like the references were recorded on different hardware.) --- Sources/MarkdownText/UI/UnorderedListView.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/MarkdownText/UI/UnorderedListView.swift b/Sources/MarkdownText/UI/UnorderedListView.swift index 8b65e25..a86bb7e 100644 --- a/Sources/MarkdownText/UI/UnorderedListView.swift +++ b/Sources/MarkdownText/UI/UnorderedListView.swift @@ -8,6 +8,8 @@ import SwiftUI struct UnorderedListView: View { + @Environment(\.markdownConfig) var config: MarkdownRenderConfig + let items: [MarkdownListItem] let nestedLevel: Int @@ -44,19 +46,19 @@ struct UnorderedListView: View { Image(systemName: checkbox == .checked ? "checkmark.square.fill" : "square") .resizable() .frame(width: 12, height: 12) - .foregroundStyle( Color.Theme.Foreground.Primary.Primary450) + .foregroundStyle(config.orderedListStyle.textColor) .transition(.opacity) } else if nestedLevel % 2 == 0 { Image(systemName: "circle.fill") .resizable() .frame(width: 4, height: 4) - .foregroundStyle( Color.Theme.Foreground.Primary.Primary450) + .foregroundStyle(config.orderedListStyle.textColor) .transition(.opacity) } else { Image(systemName: "circle") .resizable() .frame(width: 4, height: 4) - .foregroundStyle( Color.Theme.Foreground.Primary.Primary450) + .foregroundStyle(config.orderedListStyle.textColor) .transition(.opacity) } }.frame(width: 22.0)