Alter the color of a watermark preset based on background color

Again, frame color is something that you could easily do with G’MIC or Imagemagick but I guess you would like to do it within darktable. E.g., I don’t do watermarks in my PlayRaws but I sometimes frame them using the average color. Simple example:

gmic sample tiger frame 10,10,${-average_color}