material-foundation / material-color-utilities

Color libraries for Material You
Apache License 2.0
1.71k stars 151 forks source link

Inconsistency between dart and typescript schemes #162

Open Harm-Nullix opened 2 months ago

Harm-Nullix commented 2 months ago

I compared the dart dynamic schemes with different contrasts against each other. They differ a lot.

Starting with the "seed" which is a argbFromHex output from the primary color in the "coreColors" section. Why is this so much bigger/different.

Because of this, it does not feel reliable using this library. The diff: https://www.diffchecker.com/qxi77dR4/

LEFT IS DART, RIGHT IS TS

Some colors on background and stuff are different. I did not do much,

// create core pallet
  final CorePalette corePalette = CorePalette.of(argb);

// add dynamic scheme for all 
 dynamicSchemes.add(DynamicScheme(
            sourceColorArgb: argb,
            contrastLevel: contrast,
            variant: Variant.values[name.index],
            isDark: isDark,
            primaryPalette: corePalette.primary,
            secondaryPalette: corePalette.secondary,
            tertiaryPalette: corePalette.tertiary,
            neutralPalette: corePalette.neutral,
            neutralVariantPalette: corePalette.neutralVariant));
      }

// got output as hex from
StringUtils.hexFromArgb(scheme.background)

StringUtils work differently in both packages, that is clear from the source. Maybe here lies the output difference as well?

Harm-Nullix commented 2 months ago

Tried it without string utils classes, still give differnt output

(https://www.diffchecker.com/l98hFVn5/)[https://www.diffchecker.com/l98hFVn5/]