fix(theme): light 变体 on-color 对比度回归——per-variant 取色 + WCAG 对比率锁定测试#151
Open
KerroKapple wants to merge 1 commit into
Open
fix(theme): light 变体 on-color 对比度回归——per-variant 取色 + WCAG 对比率锁定测试#151KerroKapple wants to merge 1 commit into
KerroKapple wants to merge 1 commit into
Conversation
…s + 对比率锁定测试 #140 把三套主题 onPrimary/onSecondary/onError 一刀切改成 surfaceCanvas, dark/highContrast 有效但 light 是净回归:surfaceCanvas #F5EFE3 放 primary #A88340 上仅 3.06:1(旧值 fg1 4.33 也不达标但更差);dark onError 4.47 边缘差 0.03;顺带实锤同类缺陷 light cta 底 2.57(InkAmberButton)。 修法:InkColors 新增语义 token onAccent(accent/brand/cta 琥珀底前景) + onDanger(danger 红底前景),per-variant 从既有 palette 取值,零新色值: - dark: onAccent=#0B0908(8.74/9.29) onDanger=#000000(4.72,surfaceCanvas 4.47 不过线) - light: onAccent=#0B0908(5.66/6.75,借暗色画布黑) onDanger=#F5EFE3(5.06) - hc: onAccent=onDanger=#000000(13.92/7.41) 消费点同步:ColorScheme 三对色、InkButton primary/danger、InkAmberButton、 image_config_inspector selected chip。测试三层锁定 WCAG AA ≥4.5: ColorScheme 级 + token 级(含 cta)+ 组件 widget 级,杜绝再次一刀切回归。 golden:node_card 三张基线不受影响(dark onAccent 值与原 surfaceCanvas 相同,node_card 不消费 danger 底前景);本地 macOS golden 假红为既有 平台差异(干净基线同挂),如 CI 有异需 ubuntu update-goldens。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
缺陷
#140 把三套主题的 onPrimary/onSecondary/onError 一刀切改成
colors.surfaceCanvas:dark(8.74:1)与 highContrast(13.92:1)修复有效,但 light 变体是净回归——surfaceCanvas #F5EFE3 放 primary #A88340 上仅 3.06:1(旧值 4.33:1,均不达 AA 但新值更差),6 个文件的 FilledButton/InkButton primary 文字受累;dark 的 onError 4.47:1 差 0.03 不到线。现有测试只断言"等于 surfaceCanvas",锁不住对比率。深审时同型缺陷在 ink_amber_button(light cta 底 2.57:1)一并实锤。修法
InkColors新增语义 tokenonAccent(琥珀底前景)+onDanger(红底前景),per-variant 取既有 palette 值,零新色值(light 借InkPalette.surfaceCanvasDark——自家最深 fg1 只有 4.33 不过线)。消费点同步四处:app_theme ColorScheme、ink_button、ink_amber_button、image_config_inspector selected chip。最终对比率(全部 ≥4.5 AA):
测试(TDD)
三层对比率锁定(ColorScheme 级 / token 级 / 组件 widget 级,helper
test/theme/wcag.dart)。红:5 处按预期失败(light onPrimaryActual: 3.0637、dark onError4.4699、amber cta2.5707等);绿:theme 84 全过,全量--exclude-tags golden1246 passed / 46 skipped,analyze 0。Golden:node_card 基线理论不受影响(dark onAccent 值与原 surfaceCanvas 相同 #0B0908);本地 3 挂为 macOS 既有平台假红(stash 干净基线同样挂),基线未动;若 CI golden 异常需 ubuntu update-goldens。
🤖 Generated with Claude Code