TestTableFieldColors in split format
This page has a test of field colors:
|
This page has a test of field colors:
|
|
= Test simple text values =
{{{TextColorData
||text||color||
||yes||should be green||
||no||should be red||
||maybe||should be yellow||
||another line||should have no color||
}}}
|
|
{{{#!Table
source_spec=#:TextColorData
field=text
colors="""yes:green
no:red
maybe:yellow"""
}}}
|
|
= Test color expressions on integers =
{{{IntColorData
||integer||color||
||5||should be light yellow||
||10||should be yellow||
||20||should be yellow||
||50||no color||
||100||no color||
||600||should be red||
||1000||should be red||
}}}
|
|
{{{#!Table
source_spec=#:IntColorData
field=integer
colors="""(int(value)<10):ffffd0
(int(value)>=10 and int(value)<50):ffff80
(int(value)>500):ffd0d0"""
}}}
|
|
= Test some other expressions =
|
This tests use of 'in' and 'startswith'
as well as empty lines in the colors list.
|
This tests use of 'in' and 'startswith'
as well as empty lines in the colors list.
|
FruitData
||fruit||
||apple||
||banana||
||avacado||
}}}
|
{{{FruitData
||fruit||
||apple||
||banana||
||avacado||
}}}
|
|
{{{#!Table
source_spec=#:FruitData
field=fruit
colors="""apple:red
|
(value in ["lemon", "banana"]):yellow
|
(value in ["lemon", "banana"]):yellow
|
(value.startswith("av")):green
"""
|
(value.startswith("av")):green
"""
|
}}}
|
}}}
|