Skip to content

Commit 701a281

Browse files
authored
Merge pull request #42 from DutchCodingCompany/feature/new-colors
Add missing surface colors, add accent color groups
2 parents 20d590b + 70a2392 commit 701a281

6 files changed

Lines changed: 101 additions & 0 deletions

File tree

lib/style/interface/kleurplaat_interface.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ abstract interface class KleurplaatInterface<T> {
3636
/// {@endtemplate}
3737
ColorGroupInterface<T>? get tertiaryFill;
3838

39+
/// {@template accent}
40+
/// The accent color group.
41+
/// {@endtemplate}
42+
ColorGroupInterface<T>? get accent;
43+
44+
/// {@template accentFill}
45+
/// The accent fill color group.
46+
/// {@endtemplate}
47+
ColorGroupInterface<T>? get accentFill;
48+
3949
/// {@template content}
4050
/// The content color group.
4151
/// {@endtemplate}

lib/style/interface/surface_group_interface.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ abstract interface class SurfaceGroupInterface<T> {
5959
/// {@endtemplate}
6060
T get link;
6161

62+
/// {@template onColorError}
63+
/// The color on the surface for error.
64+
/// {@endtemplate}
65+
T? get onColorError;
66+
67+
/// {@template onColorSuccess}
68+
/// The color on the surface for success.
69+
/// {@endtemplate}
70+
T? get onColorSuccess;
71+
72+
/// {@template onColorPrimary}
73+
/// The color on the surface for primary.
74+
/// {@endtemplate}
75+
T? get onColorPrimary;
76+
77+
/// {@template onColorPrimaryVariant}
78+
/// The color on the surface for primary variant.
79+
/// {@endtemplate}
80+
T? get onColorPrimaryVariant;
81+
6282
/// Linearly interpolate with another object.
6383
SurfaceGroupInterface<T> lerp(covariant SurfaceGroupInterface<T>? other, double t);
6484
}

lib/style/kleurplaat/katjas_kleurplaat.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
2121
this.secondaryFill,
2222
this.tertiary,
2323
this.tertiaryFill,
24+
this.accent,
25+
this.accentFill,
2426
});
2527

2628
@override
@@ -41,6 +43,12 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
4143
@override
4244
final ColorGroup? tertiaryFill;
4345

46+
@override
47+
final ColorGroup? accent;
48+
49+
@override
50+
final ColorGroup? accentFill;
51+
4452
@override
4553
final ColorGroup content;
4654

@@ -73,6 +81,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
7381
ColorGroup? secondaryFill,
7482
ColorGroup? tertiary,
7583
ColorGroup? tertiaryFill,
84+
ColorGroup? accent,
85+
ColorGroup? accentFill,
7686
ColorGroup? content,
7787
ColorGroup? contentFill,
7888
ColorGroup? error,
@@ -88,6 +98,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
8898
secondaryFill: secondaryFill ?? this.secondaryFill,
8999
tertiary: tertiary ?? this.tertiary,
90100
tertiaryFill: tertiaryFill ?? this.tertiaryFill,
101+
accent: accent ?? this.accent,
102+
accentFill: accentFill ?? this.accentFill,
91103
content: content ?? this.content,
92104
contentFill: contentFill ?? this.contentFill,
93105
error: error ?? this.error,
@@ -109,6 +121,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
109121
secondaryFill: secondaryFill?.lerp(other.secondaryFill, t),
110122
tertiary: tertiary?.lerp(other.tertiary, t),
111123
tertiaryFill: tertiaryFill?.lerp(other.tertiaryFill, t),
124+
accent: accent?.lerp(other.accent, t),
125+
accentFill: accentFill?.lerp(other.accentFill, t),
112126
content: content.lerp(other.content, t),
113127
contentFill: contentFill.lerp(other.contentFill, t),
114128
error: error.lerp(other.error, t),
@@ -133,6 +147,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
133147
secondaryFixedDim: secondaryFill?.color,
134148
tertiaryFixed: tertiary?.color,
135149
tertiaryFixedDim: tertiaryFill?.color,
150+
onTertiaryFixed: accent?.color,
151+
onTertiaryFixedVariant: accentFill?.color,
136152
onSecondary: content.onColorContrast,
137153
onSecondaryContainer: content.onColorContrast,
138154
tertiary: error.color,

lib/style/kleurplaat/surface_group.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
1717
required this.containerHigh,
1818
required this.containerHighest,
1919
required this.link,
20+
this.onColorError,
21+
this.onColorSuccess,
22+
this.onColorPrimary,
23+
this.onColorPrimaryVariant,
2024
});
2125

2226
@override
@@ -52,6 +56,18 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
5256
@override
5357
final Color link;
5458

59+
@override
60+
final Color? onColorError;
61+
62+
@override
63+
final Color? onColorSuccess;
64+
65+
@override
66+
final Color? onColorPrimary;
67+
68+
@override
69+
final Color? onColorPrimaryVariant;
70+
5571
@override
5672
SurfaceGroup lerp(SurfaceGroup? other, double t) {
5773
if (other == null) return this;
@@ -68,6 +84,10 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
6884
containerHigh: Color.lerp(containerHigh, other.containerHigh, t)!,
6985
containerHighest: Color.lerp(containerHighest, other.containerHighest, t)!,
7086
link: Color.lerp(link, other.link, t)!,
87+
onColorError: Color.lerp(onColorError, other.onColorError, t),
88+
onColorSuccess: Color.lerp(onColorSuccess, other.onColorSuccess, t),
89+
onColorPrimary: Color.lerp(onColorPrimary, other.onColorPrimary, t),
90+
onColorPrimaryVariant: Color.lerp(onColorPrimaryVariant, other.onColorPrimaryVariant, t),
7191
);
7292
}
7393
}

lib/style/text_style/handschrift_decorator.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ class HandschriftDecorator implements KleurplaatInterface<Handschrift> {
8686
onColorSubtle: _textStyle.copyWith(color: _kleurplaat.tertiaryFill?.onColorSubtle),
8787
);
8888

89+
@override
90+
ColorGroupInterface<Handschrift> get accent => HandschriftColorGroup(
91+
color: _textStyle.copyWith(color: _kleurplaat.accent?.color),
92+
onColorContrast: _textStyle.copyWith(color: _kleurplaat.accent?.onColorContrast),
93+
onColorSubtle: _textStyle.copyWith(color: _kleurplaat.accent?.onColorSubtle),
94+
);
95+
96+
@override
97+
ColorGroupInterface<Handschrift> get accentFill => HandschriftColorGroup(
98+
color: _textStyle.copyWith(color: _kleurplaat.accentFill?.color),
99+
onColorContrast: _textStyle.copyWith(color: _kleurplaat.accentFill?.onColorContrast),
100+
onColorSubtle: _textStyle.copyWith(color: _kleurplaat.accentFill?.onColorSubtle),
101+
);
102+
89103
@override
90104
ColorGroupInterface<Handschrift> get success => HandschriftColorGroup(
91105
color: _textStyle.copyWith(color: _kleurplaat.success.color),
@@ -113,6 +127,10 @@ class HandschriftDecorator implements KleurplaatInterface<Handschrift> {
113127
containerHigh: _textStyle.copyWith(color: _kleurplaat.surface.containerHigh),
114128
containerHighest: _textStyle.copyWith(color: _kleurplaat.surface.containerHighest),
115129
link: _textStyle.copyWith(color: _kleurplaat.surface.link),
130+
onColorError: _textStyle.copyWith(color: _kleurplaat.surface.onColorError),
131+
onColorSuccess: _textStyle.copyWith(color: _kleurplaat.surface.onColorSuccess),
132+
onColorPrimary: _textStyle.copyWith(color: _kleurplaat.surface.onColorPrimary),
133+
onColorPrimaryVariant: _textStyle.copyWith(color: _kleurplaat.surface.onColorPrimaryVariant),
116134
);
117135

118136
@override
@@ -130,6 +148,10 @@ class HandschriftDecorator implements KleurplaatInterface<Handschrift> {
130148
containerHigh: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.containerHigh),
131149
containerHighest: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.containerHighest),
132150
link: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.link),
151+
onColorError: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorError),
152+
onColorSuccess: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorSuccess),
153+
onColorPrimary: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorPrimary),
154+
onColorPrimaryVariant: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorPrimaryVariant),
133155
);
134156
}
135157
}

lib/style/text_style/handschrift_surface_group.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class HandschriftSurfaceGroup implements SurfaceGroupInterface<Handschrift> {
1616
required this.containerHigh,
1717
required this.containerHighest,
1818
required this.link,
19+
this.onColorError,
20+
this.onColorSuccess,
21+
this.onColorPrimary,
22+
this.onColorPrimaryVariant,
1923
});
2024

2125
@override
@@ -42,6 +46,15 @@ class HandschriftSurfaceGroup implements SurfaceGroupInterface<Handschrift> {
4246
@override
4347
final Handschrift link;
4448

49+
@override
50+
final Handschrift? onColorError;
51+
@override
52+
final Handschrift? onColorSuccess;
53+
@override
54+
final Handschrift? onColorPrimary;
55+
@override
56+
final Handschrift? onColorPrimaryVariant;
57+
4558
@override
4659
HandschriftSurfaceGroup lerp(HandschriftSurfaceGroup? other, double t) => this;
4760
}

0 commit comments

Comments
 (0)