This PR allows the user to supply their own config object to override the defaults set it src/constants.ts
Main reason for this is I wanted to set the default gradient that is chosen when the user switch modes.
What has changed is config is now typed to:
export type Config = {
barSize: number
crossSize: number
inputSize: number
delay: number
defaultColor: string
defaultGradient: string
}
and I have put a config object in both the <PickerContext /> as well as the useColorPicker hook as I believe those are the only two places where the user would reasonable input these options. Both of these components fallback to the original options object if none is provided.
Ideally I would like the option to only be set at one place as now you would need to supply the same config object to both the <ColorPicker> component and the useColorPicker hook if you use both 🥴
This PR allows the user to supply their own
config
object to override the defaults set itsrc/constants.ts
Main reason for this is I wanted to set the default gradient that is chosen when the user switch modes.
What has changed is
config
is now typed to:and I have put a config object in both the
<PickerContext />
as well as theuseColorPicker
hook as I believe those are the only two places where the user would reasonable input these options. Both of these components fallback to the originaloptions
object if none is provided.Ideally I would like the option to only be set at one place as now you would need to supply the same
config
object to both the<ColorPicker>
component and theuseColorPicker
hook if you use both 🥴