You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [Mapping values to a color scale](#Mapping-values-to-a-color-scale)
36
+
37
+
38
+
## The Color type
39
+
40
+
There are many ways how plotly.js handles colors. In general, individual colors can be set the same way as in general html/css - so for example string representations of (a)rgb, hsl, or keywords such as "red"
41
+
Additionally to that, there are several ways of controlling color attributes of plotly objects:
42
+
43
+
- Setting a single color which will be used for all elements in a collection, for example all markers: `"rgb(r,g,b)"` or `"red"`
44
+
- Setting an array of colors to assign single colors for each individual item in a collection, for example each individual marker: `["red","blue"]`
45
+
- Mapping values to a color scale, for example coloring markers by intensity of the datum: `[6.9, 4.2]`
46
+
- These can also be mixed in collections.
47
+
48
+
To do this justice in Plotly.NET in a type-safe way, we provide the dedicated `Color` type that has methods to create all of these variants.
49
+
50
+
The `Color` type provides methods to initialize all of the above mentioned ways to control color attributes of plotly charts.
51
+
Color Keywords and ARGB are also wrapped in a typesafe way:
52
+
*)
53
+
54
+
openPlotly.NET
55
+
56
+
// single colors
57
+
letsingleColor1= Color.fromKeyword Red // using html color keywords
58
+
letsingleColor2= Color.fromARGB 25542131// using type-safe argb
0 commit comments