aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index df160a3a4..ac9b57414 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -524,18 +524,18 @@ export class CollectionSchemaView extends CollectionSubView() {
const randomRGBColor = (): string[] => {
let r; let g; let b;
- do {
- r = Math.floor(Math.random() * 256);
- g = Math.floor(Math.random() * 256);
- b = Math.floor(Math.random() * 256);
- } while ((r + g + b) < 400 || (r + g + b) > 450);
+ const brightness = 450;
+ r = Math.floor(Math.random() * 256);
+ g = Math.floor(Math.random() * Math.min(256, brightness - r));
+ b = Math.floor(brightness - r - g);
- const rL = ClientUtils.lightenRGB(r, g, b, 60)[0];
- const gL = ClientUtils.lightenRGB(r, g, b, 60)[1];
- const bL = ClientUtils.lightenRGB(r, g, b, 60)[2];
- const backgroundRGB = {rL, gL, bL};
+ const lightenedRGB = ClientUtils.lightenRGB(r, g, b, 65);
+ const rL = lightenedRGB[0];
+ const gL = lightenedRGB[1];
+ const bL = lightenedRGB[2];
+ const bgdRGB = {rL, gL, bL};
- return new Array<string>(`rgb(${r}, ${g}, ${b})`, `rgb(${backgroundRGB.rL}, ${backgroundRGB.gL}, ${backgroundRGB.bL})`);
+ return new Array<string>(`rgb(${r}, ${g}, ${b})`, `rgb(${bgdRGB.rL}, ${bgdRGB.gL}, ${bgdRGB.bL})`);
}
const cellsToHighlight = this.findCellRefs(text);