@datagrok/bio 2.15.10 → 2.15.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Aleksandr Tanas",
6
6
  "email": "atanas@datagrok.ai"
7
7
  },
8
- "version": "2.15.10",
8
+ "version": "2.15.11",
9
9
  "description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -37,21 +37,28 @@ export class MonomerCellRendererBack extends CellRendererWithMonomerLibBackBase
37
37
  const symbol: string = gridCell.cell.value;
38
38
  if (!symbol || symbol == GAP_SYMBOL) return;
39
39
 
40
- let color = undefinedColor;
40
+ let textcolor = undefinedColor;
41
+ let backgroundcolor = 'rgb(255, 255, 255)';
41
42
  if (this.monomerLib) {
42
43
  const alphabet = this.tableCol.getTag(bioTAGS.alphabet);
43
44
  const biotype = alphabet === ALPHABET.RNA || alphabet === ALPHABET.DNA ? HelmTypes.NUCLEOTIDE : HelmTypes.AA;
44
- color = this.monomerLib.getMonomerTextColor(biotype, symbol);
45
+ if (applyToBackground) {
46
+ const colors = this.monomerLib.getMonomerColors(biotype, symbol);
47
+ textcolor = colors?.textcolor ?? textcolor;
48
+ backgroundcolor = colors?.backgroundcolor ?? backgroundcolor;
49
+ } else {
50
+ textcolor = this.monomerLib.getMonomerTextColor(biotype, symbol);
51
+ }
45
52
  }
46
53
 
47
54
  //cell width of monomer should dictate how many characters can be displayed
48
55
  // for width 40, 6 characters can be displayed (0.15 is 6 / 40)
49
56
  const maxChars = Math.max(2, Math.floor(w * 0.15));
50
- g.fillStyle = color;
51
57
  if (applyToBackground) {
58
+ g.fillStyle = backgroundcolor;
52
59
  g.fillRect(x, y, w, h);
53
- g.fillStyle = DG.Color.toHtml(DG.Color.getContrastColor(DG.Color.fromHtml(color)));
54
60
  }
61
+ g.fillStyle = textcolor;
55
62
  g.fillText(monomerToShort(symbol, maxChars), x + (w / 2), y + (h / 2), w);
56
63
  } finally {
57
64
  g.restore();