Skip to content

Read the list-marker color from MarkdownRenderConfig - #164

Open
lukebradford wants to merge 1 commit into
microsoft:mainfrom
yoshi-ai-dev:upstream-list-marker-color
Open

Read the list-marker color from MarkdownRenderConfig#164
lukebradford wants to merge 1 commit into
microsoft:mainfrom
yoshi-ai-dev:upstream-list-marker-color

Conversation

@lukebradford

Copy link
Copy Markdown

OrderedListView colors its numerals with config.orderedListStyle.textColor, but UnorderedListView draws its bullet and its task-list checkbox with a literal Color.Theme.Foreground.Primary.Primary450.

A host that themes MarkdownRenderConfig 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 from an ancestor. In our case (a warm, near-black/near-white palette) the bullets came out mid-gray in light and blue-gray in dark, next to text that was neither.

This routes the bullet and the checkbox through the same config property the ordered list already uses.

Why this is safe

It's a no-op on the default config: defaultOrderedListStyle's textColor is Primary450, the exact literal being replaced. Only a host that has already overridden orderedListStyle sees any change — and that's the change it asked for.

I verified by running UnorderedListViewTests before and after the patch: byte-identical results, same failures, same snapshot names.

Note for CI

Those snapshot tests already fail for me at unmodified main — 10 reference mismatches under macOS-standard-light / macOS-standard-dark, across UnorderedListViewTests and TableViewSnapshotTests.testTableCellWithOnlyCitation. They look recorded on different hardware than mine. So my verification above is "identical before and after", not "green", and it may be worth a look independently of this PR.

Alternative

If you'd rather not overload orderedListStyle for unordered markers, I'm happy to add a dedicated unorderedListStyle (or a shared listMarkerStyle) instead — that's a public API addition, which is why I didn't reach for it first. Say the word and I'll rework it.

🤖 Generated with Claude Code

`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.)
@lukebradford
lukebradford requested review from a team and a lite review from Copilot August 12, 2026 00:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes unordered list markers (bullets and task-list checkboxes) respect the host-provided MarkdownRenderConfig color, aligning their appearance with ordered-list numerals and preventing mixed “themed text + bundled-palette markers” rendering in the same document.

Changes:

  • Inject MarkdownRenderConfig via @Environment(\.markdownConfig) in UnorderedListView.
  • Replace hard-coded marker foregroundStyle color with config.orderedListStyle.textColor for bullets and task checkboxes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

.resizable()
.frame(width: 12, height: 12)
.foregroundStyle( Color.Theme.Foreground.Primary.Primary450)
.foregroundStyle(config.orderedListStyle.textColor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants