Skip to content

Commit fb0562f

Browse files
authored
Merge pull request #18 from DutchCodingCompany/feature/expand-kleurplaat
Add secondary and tertiary colors to kleurplaat
2 parents 4bd8f8f + cfa211d commit fb0562f

File tree

4 files changed

+110
-6
lines changed

4 files changed

+110
-6
lines changed

lib/style/interface/kleurplaat_interface.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ abstract interface class KleurplaatInterface<T> {
1616
/// {@endtemplate}
1717
ColorGroupInterface<T> get primaryFill;
1818

19+
/// {@template secondary}
20+
/// The secondary color group.
21+
/// {@endtemplate}
22+
ColorGroupInterface<T>? get secondary;
23+
24+
/// {@template secondaryFill}
25+
/// The secondary fill color group.
26+
/// {@endtemplate}
27+
ColorGroupInterface<T>? get secondaryFill;
28+
29+
/// {@template tertiary}
30+
/// The tertiary color group.
31+
/// {@endtemplate}
32+
ColorGroupInterface<T>? get tertiary;
33+
34+
/// {@template tertiaryFill}
35+
/// The tertiary fill color group.
36+
/// {@endtemplate}
37+
ColorGroupInterface<T>? get tertiaryFill;
38+
1939
/// {@template content}
2040
/// The content color group.
2141
/// {@endtemplate}

lib/style/kleurplaat/katjas_kleurplaat.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
1818
required this.successFill,
1919
required this.surface,
2020
required this.surfaceInverse,
21+
this.secondary,
22+
this.secondaryFill,
23+
this.tertiary,
24+
this.tertiaryFill,
2125
});
2226

2327
@override
@@ -26,6 +30,18 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
2630
@override
2731
final ColorGroup primaryFill;
2832

33+
@override
34+
final ColorGroup? secondary;
35+
36+
@override
37+
final ColorGroup? secondaryFill;
38+
39+
@override
40+
final ColorGroup? tertiary;
41+
42+
@override
43+
final ColorGroup? tertiaryFill;
44+
2945
@override
3046
final ColorGroup content;
3147

@@ -54,6 +70,10 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
5470
ThemeExtension<KatjasKleurplaat> copyWith({
5571
ColorGroup? primary,
5672
ColorGroup? primaryFill,
73+
ColorGroup? secondary,
74+
ColorGroup? secondaryFill,
75+
ColorGroup? tertiary,
76+
ColorGroup? tertiaryFill,
5777
ColorGroup? content,
5878
ColorGroup? contentFill,
5979
ColorGroup? error,
@@ -66,6 +86,10 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
6686
KatjasKleurplaat(
6787
primary: primary ?? this.primary,
6888
primaryFill: primaryFill ?? this.primaryFill,
89+
secondary: secondary ?? this.secondary,
90+
secondaryFill: secondaryFill ?? this.secondaryFill,
91+
tertiary: tertiary ?? this.tertiary,
92+
tertiaryFill: tertiaryFill ?? this.tertiaryFill,
6993
content: content ?? this.content,
7094
contentFill: contentFill ?? this.contentFill,
7195
error: error ?? this.error,
@@ -83,6 +107,10 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
83107
return KatjasKleurplaat(
84108
primary: primary.lerp(other.primary, t),
85109
primaryFill: primaryFill.lerp(other.primaryFill, t),
110+
secondary: secondary?.lerp(other.secondary, t),
111+
secondaryFill: secondaryFill?.lerp(other.secondaryFill, t),
112+
tertiary: tertiary?.lerp(other.tertiary, t),
113+
tertiaryFill: tertiaryFill?.lerp(other.tertiaryFill, t),
86114
content: content.lerp(other.content, t),
87115
contentFill: contentFill.lerp(other.contentFill, t),
88116
error: error.lerp(other.error, t),
@@ -104,6 +132,10 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat>
104132
onPrimaryContainer: primary.onColorContrast,
105133
secondary: content.color,
106134
secondaryContainer: content.color,
135+
secondaryFixed: secondary?.color,
136+
secondaryFixedDim: secondaryFill?.color,
137+
tertiaryFixed: tertiary?.color,
138+
tertiaryFixedDim: tertiaryFill?.color,
107139
onSecondary: content.onColorContrast,
108140
onSecondaryContainer: content.onColorContrast,
109141
tertiary: error.color,

lib/style/text_style/text_style_decorator.dart

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,58 @@ class TextStyleDecorator implements KleurplaatInterface<TextStyle> {
9797
),
9898
);
9999

100+
@override
101+
ColorGroupInterface<TextStyle> get secondary => TextStyleColorGroup(
102+
color: _textStyle.copyWith(
103+
color: _kleurplaat.secondary?.color,
104+
),
105+
onColorContrast: _textStyle.copyWith(
106+
color: _kleurplaat.secondary?.onColorContrast,
107+
),
108+
onColorSubtle: _textStyle.copyWith(
109+
color: _kleurplaat.secondary?.onColorSubtle,
110+
),
111+
);
112+
113+
@override
114+
ColorGroupInterface<TextStyle> get secondaryFill => TextStyleColorGroup(
115+
color: _textStyle.copyWith(
116+
color: _kleurplaat.secondaryFill?.color,
117+
),
118+
onColorContrast: _textStyle.copyWith(
119+
color: _kleurplaat.secondaryFill?.onColorContrast,
120+
),
121+
onColorSubtle: _textStyle.copyWith(
122+
color: _kleurplaat.secondaryFill?.onColorSubtle,
123+
),
124+
);
125+
126+
@override
127+
ColorGroupInterface<TextStyle> get tertiary => TextStyleColorGroup(
128+
color: _textStyle.copyWith(
129+
color: _kleurplaat.tertiary?.color,
130+
),
131+
onColorContrast: _textStyle.copyWith(
132+
color: _kleurplaat.tertiary?.onColorContrast,
133+
),
134+
onColorSubtle: _textStyle.copyWith(
135+
color: _kleurplaat.tertiary?.onColorSubtle,
136+
),
137+
);
138+
139+
@override
140+
ColorGroupInterface<TextStyle> get tertiaryFill => TextStyleColorGroup(
141+
color: _textStyle.copyWith(
142+
color: _kleurplaat.tertiaryFill?.color,
143+
),
144+
onColorContrast: _textStyle.copyWith(
145+
color: _kleurplaat.tertiaryFill?.onColorContrast,
146+
),
147+
onColorSubtle: _textStyle.copyWith(
148+
color: _kleurplaat.tertiaryFill?.onColorSubtle,
149+
),
150+
);
151+
100152
@override
101153
ColorGroupInterface<TextStyle> get success => TextStyleColorGroup(
102154
color: _textStyle.copyWith(

pubspec.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ packages:
7474
dependency: "direct main"
7575
description:
7676
name: chopper
77-
sha256: "40899b729fb6d8969d967264b189efaf2452bc3ccf6ed0782d00f1d8a6161c31"
77+
sha256: "8b25abf4dc034b4a81c23a519691eca6bd16b70782969f95344547d1c4faf3e3"
7878
url: "https://pub.dev"
7979
source: hosted
80-
version: "8.0.3"
80+
version: "8.0.4"
8181
clock:
8282
dependency: transitive
8383
description:
@@ -388,10 +388,10 @@ packages:
388388
dependency: transitive
389389
description:
390390
name: qs_dart
391-
sha256: be73d060d29c0716ded88380ba32e87ce8105f0ba234edb3edefa0d74d47d64b
391+
sha256: eec9f5e9695a949efb1487b387256260362308da4e002a9a7637bfa5acc7e049
392392
url: "https://pub.dev"
393393
source: hosted
394-
version: "1.2.4"
394+
version: "1.3.1"
395395
recursive_regex:
396396
dependency: transitive
397397
description:
@@ -561,10 +561,10 @@ packages:
561561
dependency: transitive
562562
description:
563563
name: weak_map
564-
sha256: "95ca338f0cdf5f0022cc283dfa4d97f6f6b03752f67eca85ebe6d7a679ffe3ed"
564+
sha256: "5f8e5d5ce57dc624db5fae814dd689ccae1f17f92b426e52f0a7cbe7f6f4ab97"
565565
url: "https://pub.dev"
566566
source: hosted
567-
version: "3.0.1"
567+
version: "4.0.1"
568568
web:
569569
dependency: transitive
570570
description:

0 commit comments

Comments
 (0)