/
util.go
104 lines (96 loc) · 3.03 KB
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright 2017 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package dbtesterpb
import (
"image/color"
"sort"
"gonum.org/v1/plot/plotutil"
)
// IsValidDatabaseID returns false if the database id is not supported.
func IsValidDatabaseID(id string) bool {
_, ok := DatabaseID_value[id]
return ok
}
// GetAllDatabaseIDs returns all database ids.
func GetAllDatabaseIDs() []string {
var ids []string
for k := range DatabaseID_value {
ids = append(ids, k)
}
sort.Strings(ids)
return ids
}
func GetRGBI(databaseID string, i int) color.Color {
switch databaseID {
case "etcd__other":
return color.RGBA{94, 191, 30, 255} // green
case "etcd__tip":
return color.RGBA{24, 90, 169, 255} // blue
case "etcd__v3_2":
return color.RGBA{0, 229, 255, 255} // cyan
case "etcd__v3_3":
return color.RGBA{63, 81, 181, 255} // indigo
case "zookeeper__r3_5_3_beta":
return color.RGBA{94, 191, 30, 255} // green
case "consul__v1_0_2":
return color.RGBA{254, 25, 102, 255} // red
case "zetcd__beta":
return color.RGBA{251, 206, 0, 255} // yellow
case "cetcd__beta":
return color.RGBA{205, 220, 57, 255} // lime
}
return plotutil.Color(i)
}
func GetRGBII(databaseID string, i int) color.Color {
switch databaseID {
case "etcd__other":
return color.RGBA{155, 176, 29, 255} // light-green
case "etcd__tip":
return color.RGBA{129, 212, 247, 255} // light-blue
case "etcd__v3_2":
return color.RGBA{132, 255, 255, 255} // light-cyan
case "etcd__v3_3":
return color.RGBA{159, 168, 218, 255} // light-indigo
case "zookeeper__r3_5_3_beta":
return color.RGBA{155, 176, 29, 255} // light-green
case "consul__v1_0_2":
return color.RGBA{255, 202, 178, 255} // light-red
case "zetcd__beta":
return color.RGBA{245, 247, 166, 255} // light-yellow
case "cetcd__beta":
return color.RGBA{238, 255, 65, 255} // light-lime
}
return plotutil.Color(i)
}
func GetRGBIII(databaseID string, i int) color.Color {
switch databaseID {
case "etcd__other":
return color.RGBA{129, 210, 178, 255} // mid-cyan
case "etcd__tip":
return color.RGBA{37, 29, 191, 255} // deep-blue
case "etcd__v3_2":
return color.RGBA{0, 96, 100, 255} // deep-cyan
case "etcd__v3_3":
return color.RGBA{26, 35, 126, 255} // deep-indigo
case "zookeeper__r3_5_3_beta":
return color.RGBA{129, 210, 178, 255} // mid-cyan
case "consul__v1_0_2":
return color.RGBA{245, 144, 84, 255} // deep-red
case "zetcd__beta":
return color.RGBA{229, 255, 0, 255} // deep-yellow
case "cetcd__beta":
return color.RGBA{205, 220, 57, 255} // deep-lime
}
return plotutil.Color(i)
}