-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename TopographicMap => SubsurfaceMap. Add global colorscale (#302)
- Loading branch information
1 parent
fd1d428
commit 90b4ea7
Showing
18 changed files
with
46 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { colorTablesObj } from "@emerson-eps/color-tables"; | ||
import { ColorScale } from "@lib/utils/ColorScale"; | ||
|
||
import { Color, Rgb, parse } from "culori"; | ||
|
||
export function createContinuousColorScaleForMap(colorScale: ColorScale): colorTablesObj[] { | ||
const hexColors = colorScale.getPlotlyColorScale(); | ||
const rgbArr: [number, number, number, number][] = []; | ||
hexColors.forEach((hexColor) => { | ||
const color: Color | undefined = parse(hexColor[1]); // Returns object with r, g, b items for hex strings | ||
|
||
if (color && "r" in color && "g" in color && "b" in color) { | ||
const rgbColor = color as Rgb; | ||
rgbArr.push([hexColor[0], rgbColor.r * 255, rgbColor.g * 255, rgbColor.b * 255]); | ||
} | ||
}); | ||
|
||
return [{ name: "Continuous", discrete: false, colors: rgbArr }]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
frontend/src/modules/TopographicMap/state.ts → frontend/src/modules/SubsurfaceMap/state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters