Skip to content

fix: sync browser theme-color with Vuetify theme#151

Closed
zhangzhenghao wants to merge 1 commit intogorse-io:masterfrom
zhangzhenghao:sync-theme-color
Closed

fix: sync browser theme-color with Vuetify theme#151
zhangzhenghao wants to merge 1 commit intogorse-io:masterfrom
zhangzhenghao:sync-theme-color

Conversation

@zhangzhenghao
Copy link
Copy Markdown
Contributor

问题

Chrome 浏览器地址栏颜色与 Vuetify 主题颜色不同步。静态设置在 index.html 中的 theme-color 无法响应主题变化。

解决方案

App.vue 中添加 updateThemeColor 方法,在应用挂载时动态设置 theme-color meta 标签:

  • 从 Vuetify 主题获取 primary 颜色
  • 动态更新或创建 meta 标签
  • 确保浏览器地址栏颜色与应用主题同步

变更

  • 修改 frontend/src/App.vue:添加 mounted 钩子和 updateThemeColor 方法

- Add updateThemeColor method in App.vue to dynamically set theme-color
- Ensures browser address bar color matches Vuetify primary color
- Creates meta tag if not present, updates if exists
@zhangzhenghao
Copy link
Copy Markdown
Contributor Author

测试后发现动态设置 theme-color 的方案无效。HTML 中已有静态 <meta name="theme-color" content="#1E88E5" />,保持现有方案。

@zhangzhenghao zhangzhenghao deleted the sync-theme-color branch April 6, 2026 02:20
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.

1 participant