Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/widgets/dk_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 26 additions & 0 deletions test/theme_contrast_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Color> fgs = <String, Color>{
'fg': t.fg,
'fgMuted': t.fgMuted,
'fgSubtle': t.fgSubtle,
};
final Map<String, Color> bgs = <String, Color>{
'bg': t.bg,
'bgSubtle': t.bgSubtle,
'bgPress': t.bgPress,
'page': t.page,
};
for (final MapEntry<String, Color> f in fgs.entries) {
for (final MapEntry<String, Color> 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',
);
}
}
});
});
}

Expand Down
Loading