react-native-material-palette icon indicating copy to clipboard operation
react-native-material-palette copied to clipboard

Support custom colour profiles

Open zamotany opened this issue 6 years ago • 3 comments

Add option to create a custom colour profile and use it with addTarget method (https://developer.android.com/training/material/palette-colors.html#extract-color-profiles and https://developer.android.com/reference/android/support/v7/graphics/Palette.Builder.html#addTarget(android.support.v7.graphics.Target)).

The main difficulty is to find a nice way to create Target in JS and pass it to the native side (https://developer.android.com/reference/android/support/v7/graphics/Target.html).

zamotany avatar Oct 19 '17 10:10 zamotany

What do you think about,

type Target = {
  lightnessWeight: number,
  maximumLightness: number,
  maximumSaturation: number,
  minimumLightness: number,
  minimumSaturation: number,
  populationWeight: number,
  saturationWeight: number,
  targetLightness: number,
  targetSaturation: number,
  isExclusive: boolean,
}

type Options = {
  region?: { top: number, left: number, bottom: number, right: number },
  maximumColorCount?: number,
  type?: ColorProfile | Array<ColorProfile> | Target | Array<Target>,
}

satya164 avatar Oct 19 '17 10:10 satya164

Looks fine, are all of those properties required?

zamotany avatar Oct 19 '17 10:10 zamotany

Likely not and might have default values. but hard to say from reading the API docs.

satya164 avatar Oct 19 '17 10:10 satya164