summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-08-23 12:49:47 -0700
committerGitHub <noreply@github.com>2016-08-23 12:49:47 -0700
commit63cce78cf1597ba5879227f2298bda52e91e4e04 (patch)
treece01f8c70d8dc707469e08c892fd6a8c43d69ecd /scripts
parentfcb710fafecdafd511c2a09207b2de3077caa644 (diff)
downloadqtlocation-mapboxgl-63cce78cf1597ba5879227f2298bda52e91e4e04.tar.gz
[core] Add static getters for property default values (#6124)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generate-style-code.js16
1 files changed, 15 insertions, 1 deletions
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) {