Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom ColorPalette to enable Alpha Channel #5382

Closed

Conversation

bordoni
Copy link
Member

@bordoni bordoni commented Mar 4, 2018

Description

Resolves #4726

How Has This Been Tested?

Used internally on my own custom block for testing, and it didn't break any of the existing ColorPalette usaged.

Types of changes

Introduced a way to allow ColorPalette to have Alpha Channels enabled by third-party developers.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code has proper inline documentation.

@@ -61,7 +61,7 @@ export function ColorPalette( { colors, disableCustomColors = false, value, onCh
color={ value }
onChangeComplete={ ( color ) => onChange( color.hex ) }
style={ { width: '100%' } }
disableAlpha
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this PR but I have a concern here.

If we were to introduce this prop, why should we use it only in the ChromePicker and not for the palette colors as well?

Also, This doesn't affect the color value, since we only pass the color.hex value on the onChange call.


Can't we just keep this component as is and use a separate RangeControl if we want to tweak the alpha value? Alternatively, you can still use the ChromePicker directly in your components?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like both of the points about extending ChromePicker by yourself and RangeControl are valid.

My only point towards adding is more on the side of just making the internal Components more re-usable and less of copy the whole file into your project because some params are not exposed.

Will apply onChange modification, if you think it's worth making internal components more extendable just because.

@danielbachhuber
Copy link
Member

Closing in favor of #5835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants