Nick Opris Releases Alpha of Generic Colors Module for AI-Powered Image Analysis
Nick Opris has released an alpha version of Generic Colors, a Drupal module that uses local PHP libraries to extract dominant HEX values from uploaded images, designed for use with Drupal AI agents.
The module retrieves primary and secondary color values from media assets and returns them as structured data. Originally developed as a Drupal 7 hook-based tool for color-based search, the updated version has been rebuilt on top of the Tool API, allowing modern integration with agents like Webform AI Agent.
Unlike approaches that rely on external APIs or large language models, Generic Colors uses the local ksubileau/color-thief-php package to analyze image data. This reduces dependency on token-based AI models and speeds up image processing tasks.
The module also includes an automator, enabling automatic extraction of color data when a node is saved. The extracted dominant and distributed colors can populate multivalue text fields, supporting intelligent visual filtering and enhanced media metadata.
Compatible with Drupal 10 and 11, this alpha release is part of a growing AI ecosystem in Drupal that includes the recently introduced Webform AI Agent and the AI Agents framework. The broader goal is to support AI-assisted workflows within Drupal's site-building and editorial processes.
As noted on the project page, the module is not yet covered by Drupal’s security advisory policy. Users are encouraged to evaluate it carefully and provide feedback.
From Hook to AI: A Module’s Evolution
While contributing to Drupal AI and updating the Webform AI Agent, Nick Opris revisited a module he had built years earlier.
“The Drupal 7 version used a hook to extract HEX colour values from newly uploaded images and store them in a hidden field. It powered colour-based search, and besides being very useful, it produced some visually striking results. You can see the original colour filter in action on the DegreeArt website,”
he wrote in a LinkedIn update.
To try the module, visit the Generic Colors project page on Drupal.org.

