Once you've imported the SVG, you'll typically encounter a mix of closed paths and open paths.
For Closed Paths (Flood-Fill):You can build a Paper.js tool that lets you click on an object to select it and change its fill color.
Optionally, you might show a hover-based fill color preview to enhance the UI/UX.
Since open paths don't define a bounded area, a traditional flood-fill won’t work as expected.
A better approach would be to implement a brush-based tool in Paper.js, where the user can manually paint within or along the path.
You can use a separate layer or low-opacity strokes to simulate "filling" where path boundaries are not defined.
When converting raster images to SVG using Inkscape, paths are not always closed by default. In a past project, we established a design rule that all paths must be closed, which greatly simplified the coloring process. It may help to enforce this as a best practice if you're generating SVGs for coloring purposes.
I've worked on several interactive SVG tools and Paper.js-based editors. If you need help with this project or want to collaborate, feel free to reach out.
📧 shishi...@gmail.com
🌐 iamshishir.com
Best,
Shishir Raven