Skip to content

Commit

Permalink
Add color provider hook to manage what colors are assigned to which n…
Browse files Browse the repository at this point in the history
…ode (#1644)

* initial commit

* requested changes
  • Loading branch information
Victor-M-Giraldo authored Apr 8, 2024
1 parent 6277360 commit 64904f3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/ott-vis-panel/src/colors.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import * as d3 from "d3";

class ColorProvider {
private color = d3.scaleOrdinal(d3.schemeCategory10);
private assignments: Map<string, string> = new Map();

public assign(thing: string): string {
// TODO: implement
return "";
if (!this.assignments.has(thing)) {
this.assignments.set(thing, this.color(thing));
}
return this.assignments.get(thing)!;
}

public assignments(): Map<string, string> {
// TODO: implement
return new Map();
public getAssignments(): Map<string, string> {
return this.assignments;
}
}

Expand Down

0 comments on commit 64904f3

Please sign in to comment.