diff --git a/lib/widgets/dk_badge.dart b/lib/widgets/dk_badge.dart index 23ef0e9..79e8c6e 100644 --- a/lib/widgets/dk_badge.dart +++ b/lib/widgets/dk_badge.dart @@ -13,27 +13,26 @@ enum DkTone { neutral, primary, success, warning, danger, info, violet } } /// 디자인 시스템 뱃지. 프로토타입 `Badge`: padding 3×9, radius 8, 12/600. -/// [solid]이면 fg 배경 + 흰 글자. +/// 톤은 항상 subtle 배경 + Fg 텍스트(대비 게이트 보장 조합). 과거 solid 변형(톤색 +/// 배경 + 흰 글자)은 다크 앰버 위 대비 미달 경로라 제거했다(2026-07-05 감사). class DkBadge extends StatelessWidget { const DkBadge( this.label, { super.key, this.tone = DkTone.neutral, this.leading, - this.solid = false, }); final String label; final DkTone tone; final Widget? leading; - final bool solid; @override Widget build(BuildContext context) { final DkTokens t = DkTheme.of(context); final colors = dkToneColors(t, tone); - final Color bg = solid ? colors.fg : colors.bg; - final Color fg = solid ? t.onPrimary : colors.fg; + final Color bg = colors.bg; + final Color fg = colors.fg; return Container( padding: const EdgeInsets.symmetric( diff --git a/pubspec.lock b/pubspec.lock index 479efa9..7c6aec7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -709,7 +709,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: "1910eca50b7a64b1ebbf80c10fcc3eb30487f864" + resolved-ref: "861b9bd00fc0e35f7d01901ce97a12fb028b55f3" url: "https://github.com/ieoseo/seed-design.git" source: git version: "0.1.0" diff --git a/test/theme_contrast_test.dart b/test/theme_contrast_test.dart index 0d0f115..fd22b62 100644 --- a/test/theme_contrast_test.dart +++ b/test/theme_contrast_test.dart @@ -85,6 +85,32 @@ void main() { expect(t.byKey('onPrimary'), t.onPrimary); expect(_contrast(t.onPrimary, t.primary), greaterThanOrEqualTo(4.5)); }); + + test('본문·보조 텍스트는 표면 4종 위 4.5:1 이상(seed 게이트 미러)', () { + final Map fgs = { + 'fg': t.fg, + 'fgMuted': t.fgMuted, + 'fgSubtle': t.fgSubtle, + }; + final Map bgs = { + 'bg': t.bg, + 'bgSubtle': t.bgSubtle, + 'bgPress': t.bgPress, + 'page': t.page, + }; + for (final MapEntry f in fgs.entries) { + for (final MapEntry b in bgs.entries) { + final Color fg = _composite(f.value, b.value); + final double ratio = _contrast(fg, b.value); + expect( + ratio, + greaterThanOrEqualTo(4.5), + reason: + '$label ${f.key} on ${b.key} = ${ratio.toStringAsFixed(2)}:1', + ); + } + } + }); }); }