surfacesUseBW method

FlexTones surfacesUseBW([
  1. bool useBW = true
])

Returns a new FlexTones instance where the tones for surface and background are set 0 (black) if it was <= 60 and to 100 (white) if > 60.

This will make the seeded colors for background and surface pure black or white, depending on if they are dark or light

This is a modifier, using copyWith, that can be used to change any existing or pre-made FlexTones config to not have any color tint in their seeded surface and background colors.

The useBW flag is true by default, making the function effective. If set to false, the function is a no op and just returns the FlexTones object unmodified. This is typically used to control applying the tint removal via a controller.

Implementation

FlexTones surfacesUseBW([bool useBW = true]) {
  // ignore: avoid_returning_this
  if (!useBW) return this;
  return copyWith(
    backgroundTone: backgroundTone <= 60 ? 0 : 100,
    surfaceTone: surfaceTone <= 60 ? 0 : 100,
  );
}