Repository navigation
fix(desktop): theme the table of contents text and arrows (#5094) - #5486
Merged
Merged
Conversation
Element Plus renders every `el-tree` node label inside an `<el-text>`, which declares `color: var(--el-text-color)` (#606266) on the label itself. That beats the themed color the label only *inherits* from `.side-bar-toc .el-tree`, so the outline stayed the same gray on every theme — unreadable on dark ones. The expand arrow had the same problem via --el-tree-expand-icon-color, while the sidebar file tree (a hand-rolled component, not el-tree) colors its arrows with --sideBarIconColor. Let the label inherit the panel color again and point the arrow at the sidebar icon color, so the outline matches the file tree the report compares it to. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Build artifacts for PR #5486: Run: https://github.com/marktext/marktext/actions/runs/35591552997
|
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.
Closes #5094.
Reproduced
The outline panel renders the same gray on every theme. On
material-darkthelabel color computes to
rgb(96, 98, 102)while the panel's themed color isrgba(255, 255, 255, 0.6)— dark gray text on a dark background.Sampling the reporter's screenshots confirms the same values: the TOC text is
#606266in both their light and dark captures, while the sidebar file treetext tracks the theme (
#a9abaeonmaterial-dark, i.e.--sideBarColorcomposited over
--sideBarBgColor).Root cause
Element Plus renders each tree node label as
<span class="el-text is-truncated el-tree-node__label">, and.el-textdeclares a color of its own:
toc.vueonly setscolor: var(--sideBarColor)on.side-bar-toc .el-tree, sothe label inherited the themed color — and an own
colordeclaration alwaysbeats an inherited one, whatever the specificity of the ancestor rule. The
expand arrow has the same problem through
--el-tree-expand-icon-color(
--el-text-color-placeholder), while the sidebar file tree — a hand-rolledcomponent rather than an
el-tree— colors its arrows with--sideBarIconColor.That is exactly why the file tree looked right and the outline did not.
Fix
Two rules in
toc.vue: let the label inherit the panel color again, and pointthe expand arrow at
--sideBarIconColor. Leaf arrows stay invisible — Elementhides them with
visibility: hidden, not only with a transparent color.Verification
New e2e spec
test/e2e/issue-5094-toc-theming.spec.tsasserts, on both a darkand a light theme, that the label color equals the panel's themed color, that
the arrow equals
--sideBarIconColor, that neither is Element'srgb(96, 98, 102), and that the color actually changes between the two themes.It fails on
developwithExpected: "rgba(255, 255, 255, 0.6)" / Received: "rgb(96, 98, 102)"and passes with the fix.pnpm run lint(0 errors),pnpm run typecheck, and the TOC / theme /layout e2e specs (17 tests) all pass.
🤖 Generated with Claude Code