         [
             [ <color-model> <color-preview> 1 track-add ]
             [
-                [ [ truncate number>string ] map " " join ]
-                <arrow> <label-control>
+                [
+                    [ truncate >integer ] map
+                    first3 3dup "%d %d %d #%02x%02x%02x" sprintf
+                ] <arrow> <label-control>
                 f track-add
             ] bi
         ] bi* ;

! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel math math.functions math.parser models
models.arrow models.range models.product sequences ui
ui.gadgets ui.gadgets.tracks ui.gadgets.labels ui.gadgets.packs
ui.gadgets.sliders ui.pens.solid ui.render math.rectangles accessors
ui.gadgets.grids colors ;
IN: color-picker

! Simple example demonstrating the use of models.

: <color-preview> ( model -- gadget )
    color-preview new
        swap >>model
        { 200 200 } >>dim ;

M: color-preview model-changed
    swap value>> >>interior relayout-1 ;
