Skip to content

fix: prevent capability chip styles from leaking into dark theme - #9540

Closed
Sisyphbaous-DT-Project wants to merge 1 commit into
AstrBotDevs:masterfrom
Sisyphbaous-DT-Project:fix/dark-theme-color-leak
Closed

fix: prevent capability chip styles from leaking into dark theme#9540
Sisyphbaous-DT-Project wants to merge 1 commit into
AstrBotDevs:masterfrom
Sisyphbaous-DT-Project:fix/dark-theme-color-leak

Conversation

@Sisyphbaous-DT-Project

@Sisyphbaous-DT-Project Sisyphbaous-DT-Project commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

AstrBot v4.27.1 can render WebUI text and icons in teal after switching to dark mode. The dark-mode overrides in CapabilitySourceChip.vue used :global() only around the theme ancestor. With the currently locked Vue 3.3.4 compiler, selectors such as:

:global(.v-theme--PurpleThemeDark) .capability-source-chip--mixed

were emitted as a bare .v-theme--PurpleThemeDark selector. The last override therefore applied color: #80cbc4 !important to the entire dark theme container instead of only the mixed capability source chip.

Modifications / 改动点

  • Wrap the complete dark-theme ancestor and capability chip descendant selector in :global() for the plugin, mcp, local, preset, and mixed tones.

  • Preserve all existing chip colors while preventing them from being inherited by unrelated WebUI content.

  • Keep the light theme, theme color definitions, public APIs, dependencies, and generated files unchanged.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

5bbc592a5a8fd834d2bb3c6edabd9826

Manual verification on Windows:

  • Light mode retains its existing blue color scheme.
  • Dark mode text and icons no longer inherit the mixed chip's teal color.
  • Dark mode primary elements use the configured blue theme color.
  • Repeated light-to-dark theme switching does not leave stale colors.

Automated and build verification:

node --test tests/*.test.mjs
36 tests passed, 0 failed

npx -y pnpm@10.28.2 run build
Production build completed successfully (3,793 modules transformed)

The generated CapabilitySourceChip-*.css contains all five descendant selectors, contains no bare .v-theme--PurpleThemeDark { color: ... } rule, and applies #80cbc4 only to .capability-source-chip--mixed.


Checklist / 检查清单

  • N/A: this PR fixes a regression and does not add a new feature.
  • The change has been tested, and the verification steps and results are provided above.
  • No new dependencies are introduced.
  • The change does not introduce malicious code.

修正 CapabilitySourceChip 深色样式的 scoped :global() 选择器范围,避免 Vue 编译后将标签颜色错误应用到整个 PurpleThemeDark 根节点。

保留五种能力来源标签的既有配色,仅将主题祖先与目标子类放入同一全局选择器。

验证:36 项 Dashboard Node 测试通过;pnpm 10.28.2 生产构建通过;构建产物确认 #80cbc4 仅作用于 mixed 标签。
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. area:webui The bug / feature is about webui(dashboard) of astrbot. labels Aug 4, 2026
@dosubot

dosubot Bot commented Aug 4, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about AstrBot Add Dosu to your team

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter

Soulter commented Aug 4, 2026

Copy link
Copy Markdown
Member

already fixed in #9541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants