change the color for ease and intervals to viridis

This commit is contained in:
OblivionSword 2025-08-11 22:07:57 +02:00
parent 4fead000c2
commit 5dc9557fef
2 changed files with 6 additions and 5 deletions

View file

@ -9,7 +9,7 @@ import type { GraphsResponse } from "@generated/anki/stats_pb";
import * as tr from "@generated/ftl"; import * as tr from "@generated/ftl";
import { localizedNumber } from "@tslib/i18n"; import { localizedNumber } from "@tslib/i18n";
import type { Bin, ScaleLinear, ScaleSequential } from "d3"; import type { Bin, ScaleLinear, ScaleSequential } from "d3";
import { bin, extent, interpolateRdYlGn, interpolateTurbo, interpolateViridis, scaleLinear, scaleSequential, sum } from "d3"; import { bin, extent, interpolateRdYlGn, interpolateViridis, scaleLinear, scaleSequential, sum } from "d3";
import type { SearchDispatch, TableDatum } from "./graph-helpers"; import type { SearchDispatch, TableDatum } from "./graph-helpers";
import { getNumericMapBinValue, numericMap } from "./graph-helpers"; import { getNumericMapBinValue, numericMap } from "./graph-helpers";
@ -89,7 +89,7 @@ export function prepareData(
if ((window as any).colorBlindMode) if ((window as any).colorBlindMode)
{ {
colourScale = scaleSequential(interpolateTurbo).domain([xMin, 300]); colourScale = scaleSequential(interpolateViridis).domain([xMin, 300]);
} }
else else
{ {

View file

@ -10,7 +10,7 @@ import * as tr from "@generated/ftl";
import { localizedNumber } from "@tslib/i18n"; import { localizedNumber } from "@tslib/i18n";
import { timeSpan } from "@tslib/time"; import { timeSpan } from "@tslib/time";
import type { Bin } from "d3"; import type { Bin } from "d3";
import { bin, extent, interpolateBlues, interpolateCividis, quantile, scaleLinear, scaleSequential, sum } from "d3"; import { bin, extent, interpolateBlues, interpolateViridis, quantile, scaleLinear, scaleSequential, sum } from "d3";
import type { SearchDispatch, TableDatum } from "./graph-helpers"; import type { SearchDispatch, TableDatum } from "./graph-helpers";
import { numericMap } from "./graph-helpers"; import { numericMap } from "./graph-helpers";
@ -147,13 +147,14 @@ export function prepareIntervalData(
return [null, []]; return [null, []];
} }
//const adjustedRange = scaleLinear().range([0.7, 0.3]);
let adjustedRange; let adjustedRange;
let colourScale; let colourScale;
if ((window as any).colorBlindMode) if ((window as any).colorBlindMode)
{ {
adjustedRange = scaleLinear().range([0.1, 1.0]); adjustedRange = scaleLinear().range([0.3, 0.7]);
colourScale = scaleSequential((n) => interpolateCividis(adjustedRange(n)!)).domain([xMax!, xMin!]); colourScale = scaleSequential((n) => interpolateViridis(adjustedRange(n)!)).domain([xMax!, xMin!]);
} }
else else
{ {