File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.0.1+9
2
+ - feat: create random color for tag.
3
+
1
4
## 0.0.1+8
2
5
- feat(convert): cache the edge names and vertex tags in graph.
3
6
- feat: support customize background.
7
+ - feat(options style): support assigning colors to vertexes through tags (name or index).
4
8
5
9
## 0.0.1+7
6
10
- feat: supported customize vertex ui.
Original file line number Diff line number Diff line change @@ -46,14 +46,7 @@ class GraphStyle {
46
46
List <Color > colors = [];
47
47
48
48
for (var tag in tags) {
49
- Color ? color;
50
- if (tagColor != null ) {
51
- color = tagColor! [tag];
52
- }
53
- if (color == null ) {
54
- var idx = allTags.indexOf (tag);
55
- if (idx < tagColorByIndex.length) color = tagColorByIndex[idx];
56
- }
49
+ Color ? color = colorByTag (tag, allTags);
57
50
if (color != null ) {
58
51
colors.add (color);
59
52
}
@@ -65,6 +58,18 @@ class GraphStyle {
65
58
return colors;
66
59
}
67
60
61
+ Color ? colorByTag (String tag, List <String > allTags) {
62
+ Color ? color;
63
+ if (tagColor != null ) {
64
+ color = tagColor! [tag];
65
+ }
66
+ if (color == null ) {
67
+ var idx = allTags.indexOf (tag);
68
+ if (idx < tagColorByIndex.length) color = tagColorByIndex[idx];
69
+ }
70
+ return color;
71
+ }
72
+
68
73
/// when there is not color matched in [tagColor] on [tagColorByIndex] , return random color.
69
74
///
70
75
/// 当在 [tagColor] 与 [tagColorByIndex] 中匹配不到颜色时,返回随机颜色
You can’t perform that action at this time.
0 commit comments