-
Notifications
You must be signed in to change notification settings - Fork 18
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 Color Customization for JupyterCAD Models #397
Conversation
Thank you for working on it. Adding a new |
@trungleduc I suggested getting rid of guidata in here: #394 I believe we should do the guidata -> color/transparency translation in Python in our freecad handler. What do you think? |
👍, |
It should also be fairly easy, it is just a dictionary |
jcad-color.mp4Setting custom color here in More context: I've been logging and observing
|
You would also need to set the color here when building the shapes. This gets called whenever there is a change in the object (size, position etc). You should be able to get the color property around here: Note that you only changed the schema for the box, you'd need to change all schemas that should define a color. |
We'll eventually get rid of guidata, maybe in this PR, so you should not depend on it. |
Thanks a lot, this really helps 💐
Yes, I'm planning to do that once I have a proof of concept for box ready if that sounds fine. I can do it now as well if you'd like :) |
Makes sense, I'll try to avoid using it, thanks for validating. |
…still not updating however)
for more information, see https://pre-commit.ci
But wait until you change the color 💣
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
jcad-color.1.mp4Works nicely with box for me 🎉 |
Looks great! I have a small suggestion, you should be able to get a nice and shiny color picker instead of a text input if you change the uiSchema for the form building logic. Something like: uiSchema['Color'] = {
'ui:widget': 'color'
}; |
Should we update branch with respect to main if it's necessary or we can straight up request bot without waiting for that? |
It seems the bot did pick up the change https://github.com/jupytercad/JupyterCAD/actions/runs/10740182227/job/29787656302 (I see |
Yep https://github.com/jupytercad/JupyterCAD/actions/runs/10740182227/job/29787926016 CI needs to have finished before the bot can run |
Bot please update snapshots! 🤒 |
Ahh! I missed this comment. Sorry |
It's fine, the second run will just cancel eventually |
Updating branch w.r.t. Edit: Doing it now to save some time, hope it's alright. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have a couple more comments.
I'm not sure about this change. This makes edges less visible, but those are clickable so they should be easily spotted by the user. |
for more information, see https://pre-commit.ci
Which one do you prefer though? |
Visually I prefer them in your screenshot, from the UX point of view I prefer them black. Though once the object is black it won't be visible anymore. We may want a smart way to compute the edge color depending on the mesh color so that it's highlighted enough for us to see them. |
Let's not do that in this PR though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! 🚀
As a follow-up:
- get rid of guidata usage in the codebase (we will eventually need to introduce an "Visible" property to the objects)
- (Optional) figure out a smart way to compute the edge colors so that they are still visible but more pretty (make use of d3-color to make the color darker/brighter https://d3js.org/d3-color#color_darker)
Thanks a lot @martinRenou, I'll be on these :) |
This PR adds a new property "Color" in JupyterCAD objects, that allows users to change the color of individual objects within a model.
related to #394