+ (concat
+ (string-join
+ (mapcar (lambda (colour)
+ (concat
+ "\""
+ (elt colour 0) " "
+ "c #"
+ (format "%02x%02x%02x"
+ (elt colour 1)
+ (elt colour 2)
+ (elt colour 3))
+ "\""))
+ colour-map)
+ ",")
+ "\",\n"
+ "\"-- c #000000\"")))
+
+(defun sixel-image-to-xpm-pixels (sixel-image)
+ "Produce string representating pixels component of XPM representation
+of SIXEL-IMAGE."
+ (concat
+ "\""
+ (string-join
+ (mapcar (lambda (sixel-row)
+ (string-join
+ (mapcar (lambda (i)
+ (string-join
+ (mapcar (lambda (sixel)
+ (let ((pixel (elt sixel i)))
+ (if pixel
+ pixel
+ "--")))
+ sixel-row)))
+ (number-sequence 0 5))
+ "\",\n\""))
+ (sixel-image-sixels sixel-image))
+ "\",\n\"")
+ "\""))