From 63cce78cf1597ba5879227f2298bda52e91e4e04 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 23 Aug 2016 12:49:47 -0700 Subject: [core] Add static getters for property default values (#6124) --- scripts/generate-style-code.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 2a25f37112..4c5f148a00 100644 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -58,6 +58,10 @@ global.defaultValue = function (property) { return 1; } + if (property.name === 'fill-outline-color') { + return '{}'; + } + switch (property.type) { case 'number': return property.default; @@ -70,7 +74,17 @@ global.defaultValue = function (property) { return `${propertyType(property)}::${camelize(property.default)}`; } case 'color': - return `{ ${parseCSSColor(property.default).join(', ')} }` + var color = parseCSSColor(property.default).join(', '); + switch (color) { + case '0, 0, 0, 0': + return '{}'; + case '0, 0, 0, 1': + return 'Color::black()'; + case '1, 1, 1, 1': + return 'Color::white()'; + default: + return `{ ${color} }`; + } case 'array': const defaults = (property.default || []).map((e) => defaultValue({ type: property.value, default: e })); if (property.length) { -- cgit v1.2.1