Skip to content

Commit

Permalink
improve color mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarek committed Nov 28, 2023
1 parent bd18536 commit 2793996
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lenses/BoundingBoxLens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,15 @@ const BoundingBoxLens: Lens = ({ urls, values, columns }) => {
if (colorTransferFunction !== undefined) {
colorFunc = (i: number) => colorTransferFunction(categories[i]).hex();
} else {
colorFunc = (i: number) =>
colorPalette.scale().colors(categories.length)[i];
colorFunc = (i: number) => {
const dtype = (
columns[categoriesColumnIndex].type as SequenceDataType
).dtype as CategoricalDataType;
const index = dtype.categories[invertedCategories(categories[i])];
return colorPalette
.scale()
.colors(Object.keys(dtype.categories).length)[index];
};
}
}

Expand Down

0 comments on commit 2793996

Please sign in to comment.