Repository navigation
feat(media): 音视频播放器默认固定暗色(mediaTheme 配置) - #1977
Merged
Merged
Conversation
This was referenced Dec 2, 2026
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.
变更概述
音视频播放器表面新增
mediaTheme配置项:dark(默认,固定暗色)/follow(跟随应用主题)。浅色或暖色应用主题下,播放器画面底、底栏、控制条、菜单与 body 浮层默认使用暗色语义色,消除画面周围亮边;配置可切回跟随应用主题。关联 Issue
Closes #1974
变更内容
AppConfig.media_theme(camelCasemediaTheme)、validate_config枚举校验、补丁白名单nested_defaults登记、配置文档键表。normalizeMediaTheme缺省/未知值回落dark;加载/保存双向映射。VideoPlayer与MediaPlayerHost挂data-media-theme="dark";body浮层 portal 外层同挂该属性,保证浮层不逃出媒体作用域。tokens.css暗色块选择器扩为.dark, [data-media-theme="dark"],复用同一份暗色值,未新增色值。normalizeMediaTheme单测;宿主默认/跟随属性单测;player-theme浏览器用例改为「默认暗色 + follow 档浅色」并恢复原有覆盖。docs/design/system/decisions.md追加媒体表面固定暗色裁决。影响范围
dark,即新默认;用户可显式改回follow。VideoPlayer)。验证方式
npx tsc --noEmit:通过npx eslint src/:0 error(存量 warning 保持)npm test:203 files / 2510 tests 全通过cargo test --manifest-path src-tauri/Cargo.toml config:58 passed / 0 failednpx playwright test e2e/player-theme.spec.ts:6 passed成对证据(真实浏览器计算样式):
rgb(247,247,246)浅色rgb(36,38,43)rgb(251,250,248)darkrgb(19,19,22)暗色rgb(216,218,222)rgb(26,27,30)暗色followrgb(247,247,246)浅色rgb(36,38,43)rgb(251,250,248)QG-5 证据:
.artifacts/1974/state-coverage.json4 态(default-dark / default-dark-menu / follow-light / follow-dark-app),截图与断言均为 passed。质量门禁引用
e2e/player-theme.spec.ts默认态并新增默认暗色断言;follow 档用真实load_config注入恢复原有 5 条覆盖,未用 skip 跳过。setConfig+saveAppConfig),本票完成配置层与播放器消费层接线。player-theme探针并粘贴计算样式原始值,未以「测试通过」代替证据;4 态截图 manifest 已录制。风险评估
风险等级: medium
来源: ai-generated
理由是跨配置 schema 与播放器视觉层的组合改动,且改变用户可见默认;但改动面收敛在既有 token 体系内,无数据迁移、无不可逆操作。
回滚方案
git revert <merge-commit>;或将mediaTheme设为follow即可恢复旧默认行为。