Background Information
The colors used in Signatures can be displayed or changed on the color chart. Often, however, there is a desire to write an overview of all RGB values to get the colors.
Steps
You can use VBA to export the color values into a text file. Thus, the output file can be easily evaluated. I will show in the following example, how to export into a CSV file.
Here is the example of a subroutine "tbl2txt":
Declare Function GetLocaleInfo Lib "kernel32" Alias _ "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, _ ByVal lpLCData As String, ByVal cchData As Long) As Long Declare Function GetUserDefaultLCID% Lib "kernel32" () Public Const LOCALE_SLIST = &HC ' This function reads what ListSeperator must be used for the CSV files Function GetListSeparator() As String Dim ListSeparator As String Dim iRetVal1 As Long Dim iRetVal2 As Long Dim lpLCDataVar As String Dim Position As Integer Dim Locale As Long GetListSeparator = ";" Locale = GetUserDefaultLCID() iRetVal1 = GetLocaleInfo(Locale, LOCALE_SLIST, lpLCDataVar, 0) ListSeparator = String$(iRetVal1, 0) iRetVal2 = GetLocaleInfo(Locale, LOCALE_SLIST, ListSeparator, iRetVal1) Position = InStr(ListSeparator, Chr$(0)) If Position > 0 Then ListSeparator = Left$(ListSeparator, Position - 1) GetListSeparator = ListSeparator End If End Function ' Split a Long value in the RGB components Private Sub ExtractRGB(ByVal longColor As Long, intRed As Byte, intGreen As Byte, intBlue As Byte) Dim lngColor As Long lngColor = longColor intRed = lngColor Mod &H100 lngColor = lngColor \ &H100 intGreen = lngColor Mod &H100 lngColor = lngColor \ &H100 intBlue = lngColor Mod &H100 End Sub ' Extracts colors from the current colormap Sub tbl2txt() Dim tbl As ColorTable Dim col() As Long Dim r As Byte, g As Byte, b As Byte Dim bg As Long Dim Sep As String ' Read the seperator in .csv files Sep = GetListSeparator ' Read color table of active drawing file Set tbl = ActiveDesignFile.ExtractColorTable col = tbl.GetColors ' Open the CSV file for output Open ActiveDesignFile.FullName + "-rgb values.csv" For Output As #1 Print #1, "Number" + Sep + "Red" + Sep + "Green" + Sep + "Blue" ' Extract each color ofthe color chart and write it in the CSV file For i = LBound(col) To UBound(col) Call ExtractRGB(col(i), r, g, b) Print #1, Str(i) + Sep + Str(r) + Sep + Str(g) + Sep + Str(b) Next ' List the Background Color: bg = tbl.BackColor Call ExtractRGB(bg, r, g, b) Print #1, "BG" + Sep + Str(r) + Sep + Str(g) + Sep + Str(b) Close #1 End Sub
The addition delaraion of functions or subroutines are used to further the reading of the separator for CSV files or for splitting a long value in the RGB components in bytes.
For the standard color table in MicroStation:
outputs the following with the VBA routine:
Number
Red
Green
Blue
0
255
1
2
3
4
5
6
127
7
8
64
9
192
10
254
96
11
160
224
12
13
128
14
176
15
240
16
17
18
19
20
21
22
122
23
24
25
26
27
28
29
30
31
225
32
33
34
35
36
37
38
117
39
40
41
42
43
44
45
46
47
210
48
49
50
51
52
53
54
112
55
56
57
58
59
60
61
62
63
195
65
66
67
68
69
70
107
71
72
73
74
75
76
77
78
79
180
80
81
82
83
84
85
86
102
87
88
89
90
91
92
93
94
95
165
97
98
99
100
101
103
104
105
106
108
109
110
111
150
113
114
115
116
118
119
120
121
123
124
125
126
135
129
130
131
132
133
134
136
137
138
139
140
141
142
143
144
145
146
147
148
149
151
152
153
154
155
156
157
158
159
161
162
163
164
166
167
168
169
170
171
172
173
174
175
177
178
179
181
182
183
184
185
186
187
188
189
190
191
193
194
196
197
198
199
200
201
202
203
204
205
206
207
208
209
211
212
213
214
215
216
217
218
219
220
221
222
223
226
227
228
229
230
231
232
233
234
235
236
237
238
239
241
242
243
244
245
246
247
248
249
250
251
252
253
BG