#lang racket/base
(require racket/gui/base racket/class racket/match)

;;; Laurent Orseau <laurent orseau gmail com> -- 2012-04-21

;; Sample identity function:
;; string? -> (or/c string? #f)
(provide item-callback)
(define (item-callback str)
  (define c-old 
    (match (read (open-input-string str))
      [(list 'make-object 'color% r g b)
       (make-object color% r g b)]
      [else #f]))
  (let ([c (get-color-from-user #f #f c-old)])
    (and c
         (format "(make-object color% ~a ~a ~a)"
                 (send c red)
                 (send c green)
                 (send c blue)))))

;; See the manual in the Script/Help menu for more information.
; (make-object color% 148 37 37)