﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
19197	[RFC PATCH] Check if a pref could be converted to a color instead of a string	taylor.smock	team	"Example mapcss code:
{{{
#!mapcss
way[regexp_test(concat(""^("", JOSM_pref(""mapwithai.mappaint.sources"", ""microsoft|digitalglobe""), "")$""), tag(""source""))][setting(""show_new"")]:new {
    set .mapwithai;
    set_color: JOSM_pref(concat(""mapwithai.mappaint."", tag(""source""), ""_new""), #FF00FF);
}
way[regexp_test(concat(""^("", JOSM_pref(""mapwithai.mappaint.sources"", ""microsoft|digitalglobe""), "")$""), tag(""source""))][setting(""show_old"")]!:new!:modified {
    set .mapwithai;
    set_color: JOSM_pref(concat(""mapwithai.mappaint."", tag(""source""), ""_old""), #FF00FF);
}
way[regexp_test(concat(""^("", JOSM_pref(""mapwithai.mappaint.sources"", ""microsoft|digitalglobe""), "")$""), tag(""source""))][setting(""show_modified"")]:modified {
    set .mapwithai;
    set_color: JOSM_pref(concat(""mapwithai.mappaint."", tag(""source""), ""_modified""), #FF00FF);
}

way.mapwithai {
    color: prop(""set_color"");
}
}}}

I would have preferred to do something like the following:
{{{
#!mapcss
way[regexp_test(concat(""^("", JOSM_pref(""mapwithai.mappaint.sources"", ""microsoft|digitalglobe""), "")$""), tag(""source""))][setting(""show_new"")]:new {
    set .mapwithai;
    set_color: concat(""sources"", ""_new"");
}
way[regexp_test(concat(""^("", JOSM_pref(""mapwithai.mappaint.sources"", ""microsoft|digitalglobe""), "")$""), tag(""source""))][setting(""show_old"")]!:new!:modified {
    set .mapwithai;
    set_color: concat(""sources"", ""_old"");
}
way[regexp_test(concat(""^("", JOSM_pref(""mapwithai.mappaint.sources"", ""microsoft|digitalglobe""), "")$""), tag(""source""))][setting(""show_modified"")]:modified {
    set .mapwithai;
    set_color: concat(""sources"", ""_modified"");
}

way.mapwithai {
    color: prop(""set_color"")#FF00FF;
}

}}}

Unfortunately, the latter doesn't work well (I've also tried wrapping `prop` in an `eval` expression, just in case there was special handling). I tried figuring out if there was a way for me to attempt to evaluate a color expression, when there is a default. I haven't seen one. :(

I am unable to hardcode all of the possible MapWithAI sources (you can add ''any'' third-party OSM-XML server source)."	enhancement	closed	normal	20.06	Core mappaint		fixed		
