feat: add style preset, add heighmap color schemes

This commit is contained in:
Azgaar 2023-11-05 16:48:26 +04:00
parent bed7486218
commit e654dbb8a5
8 changed files with 417 additions and 15 deletions

View file

@ -177,7 +177,9 @@ function insertHtml() {
<select id="heightmapSelectionColorScheme">
<option value="bright" selected>Bright</option>
<option value="light">Light</option>
<option value="natural">Natural</option>
<option value="green">Green</option>
<option value="livid">Livid</option>
<option value="monochrome">Monochrome</option>
</select>
</div>

View file

@ -297,12 +297,18 @@ function drawHeightmap() {
TIME && console.timeEnd("drawHeightmap");
}
const colorSchemes = {
bright: d3.scaleSequential(d3.interpolateSpectral),
light: d3.scaleSequential(d3.interpolateRdYlGn),
natural: d3.scaleSequential(d3.interpolateRgbBasis(["white", "#EEEECC", "tan", "green", "teal"])),
green: d3.scaleSequential(d3.interpolateGreens),
livid: d3.scaleSequential(d3.interpolateRgbBasis(["#BBBBDD", "#2A3440", "#17343B", "#0A1E24"])),
monochrome: d3.scaleSequential(d3.interpolateGreys)
};
function getColorScheme(scheme) {
if (scheme === "bright") return d3.scaleSequential(d3.interpolateSpectral);
if (scheme === "light") return d3.scaleSequential(d3.interpolateRdYlGn);
if (scheme === "green") return d3.scaleSequential(d3.interpolateGreens);
if (scheme === "monochrome") return d3.scaleSequential(d3.interpolateGreys);
return d3.scaleSequential(d3.interpolateSpectral);
if (scheme in colorSchemes) return colorSchemes[scheme];
throw new Error(`Unsupported color scheme: ${scheme}`);
}
function getColor(value, scheme = getColorScheme()) {

View file

@ -702,7 +702,7 @@ function changeEra() {
}
async function openTemplateSelectionDialog() {
const HeightmapSelectionDialog = await import("../dynamic/heightmap-selection.js?v=1.87.00");
const HeightmapSelectionDialog = await import("../dynamic/heightmap-selection.js?v=1.93.06");
HeightmapSelectionDialog.open();
}

View file

@ -11,6 +11,7 @@ const systemPresets = [
"clean",
"atlas",
"cyberpunk",
"night",
"monochrome"
];
const customPresetPrefix = "fmgStyle_";