This template converts a "type" value to a color, using the supported icon set. It is used in Template:Marker and Template:Listing.
All colors should pass WCAG AA guidelines for color contrast.
| Type | CSS3 color name | Example |
|---|---|---|
| see | #3F75A2 | |
| do | #757575 | |
| buy | #008080 | |
| eat | #B75B1A | |
| drink | #000000 | |
| sleep | #000080 | |
| listing | #218721 | |
| go | #A52A2A | |
| city | #0000FF | |
| other | #218721 | |
| view | #4169E1 | |
| vicinity | #800000 | |
| around | #800080 |
| Input | Output | Comment |
|---|---|---|
#{{#invoke:TypeToColor|convert|sleep}} | #000080 | type to color |
#{{#invoke:TypeToColor|convert|red}} | #EB0000 | color to color |
#{{#invoke:TypeToColor|convert|wrong}} | #757575 | wrong to default |
#{{#invoke:TypeToColor|convert|}} | #757575 | no to default |
local p = {} function p.convert( frame ) return p.convertImpl(frame.args[1]) end function p.convertImpl(type) type = type:lower() local types = { ['do'] = '757575', around = '800080', buy = '008080', city = '0000FF', drink = '000000', eat = 'B75B1A', go = 'A52A2A', listing = '218721', other = '218721', see = '3F75A2', sleep = '000080', vicinity = '800000', view = '4169E1', } local result = types[type] if result then return result end -- Deprecated usage - trace it types = { black = '000000', blue = '0000FF', brown = 'A52A2A', chocolate = 'B75B1A', forestgreen = '218721', gold = '8A7500', gray = '757575', grey = '757575', lime = '608000', magenta = 'D100D1', maroon = '800000', mediumaquamarine = '2A8466', navy = '000080', orange = 'A36A00', plum = 'BA45BA', purple = '800080', red = 'EB0000', royalblue = '4169E1', silver = '757575', steelblue = '427AA9', teal = '008080', } local result = types[type] if result then return result -- .. '[[category:Fixme TypeToColor]]' end return '757575' -- .. '[[category:Fixme TypeToColor Unknown]]' end return p 
French
Deutsch