@stocksharp/diagram 1.2.0 → 1.2.1

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.
@@ -1,4 +1,5 @@
1
1
  import { SvgSurface } from './svg-surface.js';
2
+ import { readableTextOn } from './color.js';
2
3
  // Internal dependency-free canvas renderer used by StockSharpDiagram.
3
4
  //
4
5
  // Dependency-free, pure 2D canvas. Demonstrates the hard parts: typed
@@ -2925,10 +2926,14 @@ export class Diagram {
2925
2926
  catch { /* undecodable */ }
2926
2927
  }
2927
2928
  }
2928
- // Bold title centred on the light body (nudged right when an icon shows so
2929
- // they don't overlap); ports are bare colour squares on the edges.
2929
+ // Bold title centred on the body (nudged right when an icon shows so they
2930
+ // don't overlap); ports are bare colour squares on the edges. The title
2931
+ // takes its colour from the fill it sits on: that fill comes from the
2932
+ // scheme, so a node may well be darker than the title used to assume.
2930
2933
  const titleShift = n.icon ? iconW + 4 : 0;
2931
- ctx.fillStyle = hasLoadError ? '#ffffff' : '#1b1b1b';
2934
+ ctx.fillStyle = hasLoadError
2935
+ ? '#ffffff'
2936
+ : readableTextOn(active ? '#ffd1dc' : n.color);
2932
2937
  ctx.font = '600 12px Segoe UI, Tahoma, sans-serif';
2933
2938
  ctx.textAlign = 'center';
2934
2939
  ctx.textBaseline = 'middle';