Skip to content

Commit

Permalink
Convert RGBColor to hex string
Browse files Browse the repository at this point in the history
This previously worked because d3 was able to properly parse a color
string out of RGBColor. However, it's better to keep things consistent
and simple. Convert so that range is simply an array of hex color
strings.
  • Loading branch information
victorlin committed Nov 5, 2024
1 parent a35a729 commit 357d924
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util/colorScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ function createScaleForGenotype(
const range = [unknownColor, ...genotypeColors.slice(0, trueValues.length)];
// Bases are returned by orderOfGenotypeAppearance in order, unknowns at end
if (legendValues.indexOf("-") !== -1) {
range.push(rgb(217, 217, 217));
range.push(rgb(217, 217, 217).formatHex());
}
if (legendValues.indexOf("N") !== -1 && !aaGenotype) {
range.push(rgb(153, 153, 153));
range.push(rgb(153, 153, 153).formatHex());
}
if (legendValues.indexOf("X") !== -1) {
range.push(rgb(102, 102, 102));
range.push(rgb(102, 102, 102).formatHex());
}
return {
colorScale: scaleOrdinal<string>().domain(domain).range(range),
Expand Down

0 comments on commit 357d924

Please sign in to comment.