isDark static method
This static function takes a color and determines whether it is "dark." Does not account for transparency.
Example usage:
myDiagram.nodeTemplate =
$(go.Node, "Auto",
$(go.Shape, "RoundedRectangle", { strokeWidth: 0 },
new go.Binding("fill", "color")),
$(go.TextBlock,
{ margin: 8 },
new go.Binding("stroke", "color", function (c) {
// Dark nodes use white text, light nodes use black text
return go.Brush.isDark(c) ? "white" : "black";
}),
new go.Binding("text", "key")
)
);
Implementation
static _i2.bool isDark(_i2.dynamic color) => _i4.callMethod(
_declaredBrush,
'isDark',
[color],
);