color-picker: Show the hex value of the color because it's useful.

db4
Doug Coleman 2014-02-20 00:13:08 -08:00
parent dc3c947a5e
commit e259e6830d
1 changed files with 9 additions and 8 deletions

View File

@ -1,10 +1,9 @@
! Copyright (C) 2006, 2009 Slava Pestov. ! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel math math.functions math.parser models USING: accessors colors formatting kernel math math.functions
models.arrow models.range models.product sequences ui models models.arrow models.product models.range sequences ui
ui.gadgets ui.gadgets.tracks ui.gadgets.labels ui.gadgets.packs ui.gadgets ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders
ui.gadgets.sliders ui.pens.solid ui.render math.rectangles accessors ui.gadgets.tracks ui.pens.solid ;
ui.gadgets.grids colors ;
IN: color-picker IN: color-picker
! Simple example demonstrating the use of models. ! Simple example demonstrating the use of models.
@ -14,7 +13,7 @@ TUPLE: color-preview < gadget ;
: <color-preview> ( model -- gadget ) : <color-preview> ( model -- gadget )
color-preview new color-preview new
swap >>model swap >>model
{ 100 100 } >>dim ; { 200 200 } >>dim ;
M: color-preview model-changed M: color-preview model-changed
swap value>> >>interior relayout-1 ; swap value>> >>interior relayout-1 ;
@ -39,8 +38,10 @@ M: color-preview model-changed
[ [
[ <color-model> <color-preview> 1 track-add ] [ <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 f track-add
] bi ] bi
] bi* ; ] bi* ;