mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
feat: hours colorblind selection
This commit is contained in:
parent
4fead000c2
commit
f817358ec2
1 changed files with 16 additions and 5 deletions
|
@ -16,6 +16,7 @@ import {
|
||||||
axisRight,
|
axisRight,
|
||||||
curveBasis,
|
curveBasis,
|
||||||
interpolateBlues,
|
interpolateBlues,
|
||||||
|
interpolatePurples,
|
||||||
pointer,
|
pointer,
|
||||||
scaleBand,
|
scaleBand,
|
||||||
scaleLinear,
|
scaleLinear,
|
||||||
|
@ -83,11 +84,21 @@ export function renderHours(
|
||||||
.classed(oddTickClass, (d: any): boolean => d % 2 != 0)
|
.classed(oddTickClass, (d: any): boolean => d % 2 != 0)
|
||||||
.attr("direction", "ltr");
|
.attr("direction", "ltr");
|
||||||
|
|
||||||
const cappedRange = scaleLinear().range([0.1, 0.8]);
|
let cappedRange = scaleLinear().range([0.1, 0.8]);
|
||||||
const colour = scaleSequential((n) => interpolateBlues(cappedRange(n)!)).domain([
|
let colour;
|
||||||
0,
|
const isColorBlindMode = (window as any).colorBlindMode;
|
||||||
yMax,
|
|
||||||
]);
|
if(isColorBlindMode) {
|
||||||
|
colour = scaleSequential((n) => interpolatePurples(cappedRange(n)!)).domain([
|
||||||
|
0,
|
||||||
|
yMax,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
colour = scaleSequential((n) => interpolateBlues(cappedRange(n)!)).domain([
|
||||||
|
0,
|
||||||
|
yMax,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// y scale
|
// y scale
|
||||||
const yTickFormat = (n: number): string => localizedNumber(n);
|
const yTickFormat = (n: number): string => localizedNumber(n);
|
||||||
|
|
Loading…
Reference in a new issue