Updated 09212022-131444
frankly, I've needed this Shortcut for far too long. should have made it years ago.
— 𝗗 𝗔 𝗩 𝗢 𝗗 (@NeoYokel) September 21, 2022
extract (and preview) hex color values from text with regex. https://t.co/nwp0Zwq89M pic.twitter.com/xZM6pEYsQh
frankly, I've needed this Shortcut for far too long. should have made it years ago.
extract (and preview) hex color values from text with regex. https://routinehub.co/shortcut/13017
This shortcut uses a simple Regular Expression - /#(?:[0-9a-fA-F]{3}){1,2}/g
- to match any hex color values in the input text. As configured by default, said text can come from either the share sheet or the system clipboard.
Using Actions' Create Color Image
action, it then generates small, square, solid color previews of each color, over which is overlayed the hex value.
A Combine Text action gathers the matches into a simple plain text list, which is copied to the system clipboard.
The preview images are gathered into a grid and rendered in a single image using a Combine Images action, the result of which is saved by default to one's Recents iCloud Photos folder and displayed at the end of the shortcut run using a Show Result action.