-
I need a way to extract prominent colors in an image via the figma plugin api
-
say I pick an image that has a picture of a minidisc. some vibrant colors will stick out. like bright reds and oranges or bright greens or blue etc.
-
these colors I want to extract. So say i pick an image then i can get a list of prominent colors back
-
i know how to get bitmap data from an image in figma plugin so that part I know works
-
i guess there is some best practice for extracting prominent colors. like blure the image then use the statistical mean or something like that. try to find the industry best practice for this type of task etc. im sure there are many code snippets online and on github for this
Something like:
prominent_colors(nodeID: string optional, fillID: string optional, imageHash: string optional, colorCount: int (min 1, max 10), returnType: "rgb", "hex") - [rgb | string]
if only nodeID is used. pick fill index 0. if index is provided use index. if imagehash is provided use that. color count returns desired color count. if this isnt to hard to add? returnType is 0,0,1 etc. or 44FF33 etc.
can you make a proposal for such a feature?
basically you just find some inspiring images on pintrest or google. then you drop it into figma. then you ask. "extract prominent colors from these pictures. and build me a nice color pallet. Make the pallet with great design standards (pantone etc?), like primary, secondary, tierary etc. and contrast colors. make darkmode variations. And make a few different color systems". Now. What you can do is use these color vibes and just vibe out some SoMe post design, or pitch deck, or some marketing stuff. Just vibe it out. Experiment and get surprised. But at light speed. Without loosing your inspiration. I will make a video on that color feature this weekend 😬
- make a server side schema for prominent_color (see similar tools to understand how)
- register enum case for prominent_color tool (see similar tools to understand how)
- add defs.ts and registration.ts for prominent_color (see similar tools to understand how)
- make the plugin side code. add enum case here as well. (see similar tools to understand how)
- register the enum case and make handle code (see similar tools to understand how)
- add the handling code that extracts bitmap etc. see get_asset tool to see image code that can do that
- also maybe see the image style we have in the style code to understand image hash etc.
- add logic from the research material section to do the prominence extraction and send it to return it to server in a response. (see similar tools to understand how) don't invent any server code. use the same code other tools use to pass back responses with payload.
_research/_proposals/# Make prominent_colors feature for figma plugin a (1).md _research/_proposals/# Make prominent_colors feature for figma plugin a.md _research/_proposals/## Figma Plugin Color Extraction Feature.md _research/_proposals/and figma doesnt have any native plugin api to do.md _research/proposals/Complete Figma Plugin Solution Prominent Colors E (1).md _research/proposals/Complete Figma Plugin Solution Prominent Colors E.md _research/_proposals/Figma Plugin Color Extraction Feature - Complete P.md _research/_proposals/Prominent Colors Extraction Feature Proposal for F.md _research/_proposals/show me full solution that is self contained. do d.md _research/proposals/this proposal is selfcntianed. no deps.md