Conversation
Added documentation for the color picker module, including usage examples and options.
Added a period at the end of the module description and included an image.
There was a problem hiding this comment.
Pull request overview
Adds a new colorpicker module intended to provide a reusable, at-a-glance color selection UI for apps (targeted at Bangle.js 2 per PR description).
Changes:
- Introduces
modules/colorpicker.jsimplementing a grid-based color picker with optional full-screen preview. - Adds
modules/colorpicker.mddocumenting usage and available options.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| modules/colorpicker.js | New module that draws a color grid, handles touch/button input, and returns selected color via callback. |
| modules/colorpicker.md | Documentation for integrating the module and configuring available options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactor color picker logic to handle empty color options and improve haptic feedback.
Added previewTimeout variable to manage color preview timeout.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Alright, this is good to go now :) |
bobrippling
left a comment
There was a problem hiding this comment.
Nice idea, seems useful
There's a few mistakes that feel like they're a bit sloppy, is it from an AI or just some changes later on made only in one place?
| } | ||
|
|
||
| function remove() { | ||
| if(previewTimeout)clearTimeout(previewTimeout); |
There was a problem hiding this comment.
Do we want:
| if(previewTimeout)clearTimeout(previewTimeout); | |
| if(previewTimeout)previewTimeout=clearTimeout(previewTimeout); |
| if(options.back){ | ||
| options.back(); | ||
| }else{ | ||
| throw new Error("No back function provided"); |
There was a problem hiding this comment.
Is this not already covered?
| remove(); | ||
| } | ||
| }else{ | ||
| Bangle.haptic() |
There was a problem hiding this comment.
We test Bangle.haptic above but not here?
| if (options.showPreview === undefined || options.showPreview) { | ||
| g.setColor(col); | ||
| g.fillRect(rect); | ||
| previewTimeout=setTimeout(remove, 0.7 * 1000); |
There was a problem hiding this comment.
Do we want to clear the timeout first?
|
Ah - I didn't use ai, that was just me making silly mistakes :) I'll get to fixing these, but no promises when as I'll be on vacation this week |
|
No worries, thanks for your honesty - let me know if anything isn't clear / if my comments could be more helpful :) And enjoy your vacation! |
Creates colorpicker module as an easy way for apps to present users with a color selection menu.
I've been wanting a menu that could do this for a while, as the alternative before was to make a scroll menu with all the colors and have the users scroll through all of them, instead of being able to see them at a glance. Currently this only works on bangle.js 2, I'm not exactly sure how to convert it to bangle.js 1 as well. This can be used in places like clock_bg, where users need to select multiple colors, or even in the theme menu and other system-level places if the need arises.
This is my first module, so let me know if I need to do anything else or did something wrong :)
Single color mode:

Multi-select mode:

You can look at an example implementation in the Clock Background app on my app loader, and just upload the module to your watch as
colorpickervia web ide.For bangle.js 1 compatibility, would the best course of action be to make the up/down buttons change the highlighted color, then a select is used to select it?