toDark method

FlexSchemeColor toDark([
  1. int whiteBlend = 35
])

Returns a new FlexSchemeColor instance based on this one that is suitable for dark mode.

Assumes that the colors this FlexColorScheme is made for are for a light theme, it does not check that current colors actually are so.

Calculates less saturated colors of any colors defined for this FlexSchemeColor colors, by blending any none null values with white using given alpha whiteBlend percentage.

The default whiteBlend is 35%, this is normally a suitable value. For more saturated primary color try 40%, which is also used in the Material design guide to convert the default red error color for light mode to dark mode. For primary light mode color with low saturation, a white blend of 20...30% often also produces nice results.

Implementation

FlexSchemeColor toDark([int whiteBlend = 35]) {
  return FlexSchemeColor.from(
    primary: primary.blend(Colors.white, whiteBlend),
    primaryVariant: primaryVariant.blend(Colors.white, whiteBlend),
    secondary: secondary.blend(Colors.white, whiteBlend),
    secondaryVariant: secondaryVariant.blend(Colors.white, whiteBlend),
    appBarColor: appBarColor?.blend(Colors.white, whiteBlend),
    error: error?.blend(Colors.white, whiteBlend),
  );
}