Skip to content

Commit 6c4d74e

Browse files
committed
Show config dropdown colorramp using js-colormaps library if TiTiler is not available
1 parent b79f05c commit 6c4d74e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

configure/src/core/injectables.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,26 @@ function getColormapNames(injectableName) {
105105
injectables[injectableName] = Object.keys(colormapData);
106106
}
107107
);
108+
} else {
109+
// Get colormaps from js-colormaps and the inversed colors
110+
const js_colormaps = Object.keys(colormapData).map((color => color.toLowerCase()));
111+
let colormaps = [];
112+
js_colormaps.forEach((color) => {
113+
colormaps.push(color);
114+
// js-colormaps only includes the non reversed names so add the reverse
115+
if (!color.endsWith("_r")) {
116+
colormaps.push(`${color}_r`);
117+
}
118+
});
119+
120+
// Sort
121+
colormaps.sort();
122+
123+
// ... new Set removes duplicates
124+
injectables[injectableName] = [
125+
...new Set(
126+
injectablesDefaults[injectableName].concat(colormaps)
127+
),
128+
];
108129
}
109130
}

0 commit comments

Comments
 (0)