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

Add selectByColor to ColorPickerController #45

Merged
merged 3 commits into from
Dec 3, 2023

Conversation

ruigoncalo
Copy link
Contributor

🎯 Goal

Currently the HsvColorPicker color is only updated by interacting with it. The only way we have to select a specific color without interacting with the picker is by setting an initialColor. However, it may be useful to select a color at any time without interacting with the picker.

🛠 Implementation details

This PR introduces the selectByColor(color: Color, fromUser: Boolean) public method that allows to select a color on the picker. fromUser enables notifying the color change. This method also updates the brightness. In this case fromUser is false to avoid notifying twice.

I added an example on the HsvColorPickerColoredSelectorScreen. There's a small palette of colors that can be clicked to select the same color on the picker.

Screenshot

Screenshot 2023-11-23 at 19 31 53

@ruigoncalo ruigoncalo requested a review from skydoves as a code owner November 23, 2023 19:32
Copy link
Owner

@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

Looks very good to me! Thank you for your contribution 👍

@skydoves skydoves merged commit 9bc24fc into skydoves:main Dec 3, 2023
3 checks passed
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.

2 participants