in reply to Using module Imager, how to convert scalar-color value to hex/rgba color value?
Use the rgba method to get the individual values and printf to format them in hex:
printf "%02x%02x%02x%02x\n", $colors[0]->rgba;
To output the whole array:
printf "%02x%02x%02x%02x\n", $_->rgba for @colors;
|
|---|