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
10 changes: 10 additions & 0 deletions lib/style/interface/kleurplaat_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ abstract interface class KleurplaatInterface<T> {
/// {@endtemplate}
ColorGroupInterface<T>? get tertiaryFill;

/// {@template accent}
/// The accent color group.
/// {@endtemplate}
ColorGroupInterface<T>? get accent;

/// {@template accentFill}
/// The accent fill color group.
/// {@endtemplate}
ColorGroupInterface<T>? get accentFill;

/// {@template content}
/// The content color group.
/// {@endtemplate}
Expand Down
20 changes: 20 additions & 0 deletions lib/style/interface/surface_group_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ abstract interface class SurfaceGroupInterface<T> {
/// {@endtemplate}
T get link;

/// {@template onColorError}
/// The color on the surface for error.
/// {@endtemplate}
T? get onColorError;

/// {@template onColorSuccess}
/// The color on the surface for success.
/// {@endtemplate}
T? get onColorSuccess;

/// {@template onColorPrimary}
/// The color on the surface for primary.
/// {@endtemplate}
T? get onColorPrimary;

/// {@template onColorPrimaryVariant}
/// The color on the surface for primary variant.
/// {@endtemplate}
T? get onColorPrimaryVariant;

/// Linearly interpolate with another object.
SurfaceGroupInterface<T> lerp(covariant SurfaceGroupInterface<T>? other, double t);
}
16 changes: 16 additions & 0 deletions lib/style/kleurplaat/katjas_kleurplaat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
this.secondaryFill,
this.tertiary,
this.tertiaryFill,
this.accent,
this.accentFill,
});

@override
Expand All @@ -41,6 +43,12 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
@override
final ColorGroup? tertiaryFill;

@override
final ColorGroup? accent;

@override
final ColorGroup? accentFill;

@override
final ColorGroup content;

Expand Down Expand Up @@ -73,6 +81,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
ColorGroup? secondaryFill,
ColorGroup? tertiary,
ColorGroup? tertiaryFill,
ColorGroup? accent,
ColorGroup? accentFill,
ColorGroup? content,
ColorGroup? contentFill,
ColorGroup? error,
Expand All @@ -88,6 +98,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
secondaryFill: secondaryFill ?? this.secondaryFill,
tertiary: tertiary ?? this.tertiary,
tertiaryFill: tertiaryFill ?? this.tertiaryFill,
accent: accent ?? this.accent,
accentFill: accentFill ?? this.accentFill,
content: content ?? this.content,
contentFill: contentFill ?? this.contentFill,
error: error ?? this.error,
Expand All @@ -109,6 +121,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
secondaryFill: secondaryFill?.lerp(other.secondaryFill, t),
tertiary: tertiary?.lerp(other.tertiary, t),
tertiaryFill: tertiaryFill?.lerp(other.tertiaryFill, t),
accent: accent?.lerp(other.accent, t),
accentFill: accentFill?.lerp(other.accentFill, t),
content: content.lerp(other.content, t),
contentFill: contentFill.lerp(other.contentFill, t),
error: error.lerp(other.error, t),
Expand All @@ -133,6 +147,8 @@ class KatjasKleurplaat extends ThemeExtension<KatjasKleurplaat> implements Kleur
secondaryFixedDim: secondaryFill?.color,
tertiaryFixed: tertiary?.color,
tertiaryFixedDim: tertiaryFill?.color,
onTertiaryFixed: accent?.color,
onTertiaryFixedVariant: accentFill?.color,
onSecondary: content.onColorContrast,
onSecondaryContainer: content.onColorContrast,
tertiary: error.color,
Expand Down
20 changes: 20 additions & 0 deletions lib/style/kleurplaat/surface_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
required this.containerHigh,
required this.containerHighest,
required this.link,
this.onColorError,
this.onColorSuccess,
this.onColorPrimary,
this.onColorPrimaryVariant,
});

@override
Expand Down Expand Up @@ -52,6 +56,18 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
@override
final Color link;

@override
final Color? onColorError;

@override
final Color? onColorSuccess;

@override
final Color? onColorPrimary;

@override
final Color? onColorPrimaryVariant;

@override
SurfaceGroup lerp(SurfaceGroup? other, double t) {
if (other == null) return this;
Expand All @@ -68,6 +84,10 @@ class SurfaceGroup implements SurfaceGroupInterface<Color> {
containerHigh: Color.lerp(containerHigh, other.containerHigh, t)!,
containerHighest: Color.lerp(containerHighest, other.containerHighest, t)!,
link: Color.lerp(link, other.link, t)!,
onColorError: Color.lerp(onColorError, other.onColorError, t),
onColorSuccess: Color.lerp(onColorSuccess, other.onColorSuccess, t),
onColorPrimary: Color.lerp(onColorPrimary, other.onColorPrimary, t),
onColorPrimaryVariant: Color.lerp(onColorPrimaryVariant, other.onColorPrimaryVariant, t),
);
}
}
22 changes: 22 additions & 0 deletions lib/style/text_style/handschrift_decorator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ class HandschriftDecorator implements KleurplaatInterface<Handschrift> {
onColorSubtle: _textStyle.copyWith(color: _kleurplaat.tertiaryFill?.onColorSubtle),
);

@override
ColorGroupInterface<Handschrift> get accent => HandschriftColorGroup(
color: _textStyle.copyWith(color: _kleurplaat.accent?.color),
onColorContrast: _textStyle.copyWith(color: _kleurplaat.accent?.onColorContrast),
onColorSubtle: _textStyle.copyWith(color: _kleurplaat.accent?.onColorSubtle),
);

@override
ColorGroupInterface<Handschrift> get accentFill => HandschriftColorGroup(
color: _textStyle.copyWith(color: _kleurplaat.accentFill?.color),
onColorContrast: _textStyle.copyWith(color: _kleurplaat.accentFill?.onColorContrast),
onColorSubtle: _textStyle.copyWith(color: _kleurplaat.accentFill?.onColorSubtle),
);

@override
ColorGroupInterface<Handschrift> get success => HandschriftColorGroup(
color: _textStyle.copyWith(color: _kleurplaat.success.color),
Expand Down Expand Up @@ -113,6 +127,10 @@ class HandschriftDecorator implements KleurplaatInterface<Handschrift> {
containerHigh: _textStyle.copyWith(color: _kleurplaat.surface.containerHigh),
containerHighest: _textStyle.copyWith(color: _kleurplaat.surface.containerHighest),
link: _textStyle.copyWith(color: _kleurplaat.surface.link),
onColorError: _textStyle.copyWith(color: _kleurplaat.surface.onColorError),
onColorSuccess: _textStyle.copyWith(color: _kleurplaat.surface.onColorSuccess),
onColorPrimary: _textStyle.copyWith(color: _kleurplaat.surface.onColorPrimary),
onColorPrimaryVariant: _textStyle.copyWith(color: _kleurplaat.surface.onColorPrimaryVariant),
);

@override
Expand All @@ -130,6 +148,10 @@ class HandschriftDecorator implements KleurplaatInterface<Handschrift> {
containerHigh: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.containerHigh),
containerHighest: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.containerHighest),
link: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.link),
onColorError: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorError),
onColorSuccess: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorSuccess),
onColorPrimary: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorPrimary),
onColorPrimaryVariant: _textStyle.copyWith(color: _kleurplaat.surfaceInverse!.onColorPrimaryVariant),
);
}
}
13 changes: 13 additions & 0 deletions lib/style/text_style/handschrift_surface_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class HandschriftSurfaceGroup implements SurfaceGroupInterface<Handschrift> {
required this.containerHigh,
required this.containerHighest,
required this.link,
this.onColorError,
this.onColorSuccess,
this.onColorPrimary,
this.onColorPrimaryVariant,
});

@override
Expand All @@ -42,6 +46,15 @@ class HandschriftSurfaceGroup implements SurfaceGroupInterface<Handschrift> {
@override
final Handschrift link;

@override
final Handschrift? onColorError;
@override
final Handschrift? onColorSuccess;
@override
final Handschrift? onColorPrimary;
@override
final Handschrift? onColorPrimaryVariant;

@override
HandschriftSurfaceGroup lerp(HandschriftSurfaceGroup? other, double t) => this;
}