Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created June 2, 2025 17:12
Show Gist options
  • Save fredgrott/c70354c83bcde4c85a00f2ba93a2edcb to your computer and use it in GitHub Desktop.
Save fredgrott/c70354c83bcde4c85a00f2ba93a2edcb to your computer and use it in GitHub Desktop.
color scheme generation via FCS for m3e expressive
// Copyright 2025 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// ignore_for_file: avoid_redundant_argument_values
import 'package:flex_color_scheme/flex_color_scheme.dart';
import 'package:flutter/material.dart';
/// schemeLight in conjunction with DesignSystemColorScheme enforce
/// Material 3 Expressive spec. In the custom build dynamic color block
/// in the declared MaterialApp widget the parameters of schemeLight are
/// filled in by the field references in DesignSystemColorScheme class.
///
/// @author Fredrick Allan Grott
ColorScheme schemeLight(
Color primary,
double contrast,
FlexSchemeVariant variant, [
Color? secondary,
Color? tertiary,
]) => SeedColorScheme.fromSeeds(
brightness: Brightness.light,
primaryKey: primary,
secondaryKey: secondary,
tertiaryKey: tertiary,
variant: variant,
contrastLevel: contrast,
useExpressiveOnContainerColors: true,
);
// schemeLightHighContrast in conjunction with DesignSystemColorScheme enforce
/// Material 3 Expressive spec. In the custom build dynamic color block
/// in the declared MaterialApp widget the parameters of schemeLight are
/// filled in by the field references in DesignSystemColorScheme class.
///
/// @author Fredrick Allan Grott
ColorScheme schemeLightHighContrast(
Color primary,
double contrast,
FlexSchemeVariant variant, [
Color? secondary,
Color? tertiary,
]) => SeedColorScheme.fromSeeds(
brightness: Brightness.light,
primaryKey: primary,
secondaryKey: secondary,
tertiaryKey: tertiary,
variant: variant,
contrastLevel: contrast,
useExpressiveOnContainerColors: true,
);
// schemeDark in conjunction with DesignSystemColorScheme enforce
/// Material 3 Expressive spec. In the custom build dynamic color block
/// in the declared MaterialApp widget the parameters of schemeLight are
/// filled in by the field references in DesignSystemColorScheme class.
///
/// @author Fredrick Allan Grott
ColorScheme schemeDark(
Color primary,
double contrast,
FlexSchemeVariant variant, [
Color? secondary,
Color? tertiary,
]) => SeedColorScheme.fromSeeds(
brightness: Brightness.dark,
primaryKey: primary,
secondaryKey: secondary,
tertiaryKey: tertiary,
variant: variant,
contrastLevel: contrast,
useExpressiveOnContainerColors: true,
);
// schemeDarkHighContrast in conjunction with DesignSystemColorScheme enforce
/// Material 3 Expressive spec. In the custom build dynamic color block
/// in the declared MaterialApp widget the parameters of schemeLight are
/// filled in by the field references in DesignSystemColorScheme class.
///
/// @author Fredrick Allan Grott
ColorScheme schemeDarkHighContrast(
Color primary,
double contrast,
FlexSchemeVariant variant, [
Color? secondary,
Color? tertiary,
]) => SeedColorScheme.fromSeeds(
brightness: Brightness.dark,
primaryKey: primary,
secondaryKey: secondary,
tertiaryKey: tertiary,
variant: variant,
contrastLevel: contrast,
useExpressiveOnContainerColors: true,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment