Skip to content

Commit

Permalink
Improved style layers code
Browse files Browse the repository at this point in the history
davenquinn committed Nov 14, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
1 parent 812d2d6 commit 3cfe425
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/mapbox-styles/src/styles/layers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import chroma from "chroma-js";
import { intervals } from "@macrostrat/timescale";
import { mergeStyles } from "@macrostrat/mapbox-utils";
import { toRGBAString, asChromaColor } from "@macrostrat/color-utils";

export function buildBasicStyle({
color = "rgb(74, 242, 161)",
@@ -10,13 +8,11 @@ export function buildBasicStyle({
tileURL,
}): mapboxgl.Style {
const xRayColor = (opacity = 1, darken = 0) => {
const c = asChromaColor(color);
if (!inDarkMode) {
return chroma(color)
.darken(2 - darken)
.alpha(opacity)
.css();
return toRGBAString(c.darken(2 - darken).alpha(opacity));
}
return chroma(color).alpha(opacity).darken(darken).css();
return toRGBAString(c.alpha(opacity).darken(darken));
};

return {

0 comments on commit 3cfe425

Please sign in to comment.