color-table: add column filled with respective colors
Side note: it would be better to simply set the cell background color. Unfortunately, no such mechanism exists at the moment.locals-and-roots
parent
8f8ab48346
commit
f8b1269ef2
|
@ -1,21 +1,28 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel accessors combinators.smart sorting.human
|
USING: kernel accessors combinators.smart sorting.human
|
||||||
models colors.constants present sorting.slots
|
models colors.constants present sorting.slots combinators
|
||||||
ui ui.gadgets.tables ui.gadgets.scrollers ;
|
ui ui.gadgets.tables ui.gadgets.scrollers strings literals ;
|
||||||
IN: color-table
|
IN: color-table
|
||||||
|
|
||||||
! ui.gadgets.tables demo
|
! ui.gadgets.tables demo
|
||||||
SINGLETON: color-renderer
|
SINGLETON: color-renderer
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
CONSTANT: full-block-string $[ 10 CHAR: full-block <string> ]
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
M: color-renderer filled-column
|
M: color-renderer filled-column
|
||||||
drop 0 ;
|
drop 0 ;
|
||||||
|
|
||||||
M: color-renderer column-titles
|
M: color-renderer column-titles
|
||||||
drop { "Name" "Red" "Green" "Blue" } ;
|
drop { "Color" "Name" "Red" "Green" "Blue" } ;
|
||||||
|
|
||||||
M: color-renderer row-columns
|
M: color-renderer row-columns
|
||||||
drop [
|
drop [
|
||||||
|
full-block-string swap
|
||||||
dup named-color
|
dup named-color
|
||||||
[ red>> present ]
|
[ red>> present ]
|
||||||
[ green>> present ]
|
[ green>> present ]
|
||||||
|
|
Loading…
Reference in New Issue