Skip to content

Commit 5895040

Browse files
Script autocoloring inaccurate and out of date. (#577)
* Updated script autocolor code to include marks scripts, and new trust/risk coloring. * Removed forced scriptname coloring from priv_store page. * Fix linter errors * Bump. --------- Co-authored-by: matr1x-hackmud <[email protected]>
1 parent 03e249f commit 5895040

File tree

4 files changed

+90
-11
lines changed

4 files changed

+90
-11
lines changed

docs/autocolor_demo.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ unlisted: true
55

66
### simple
77

8-
(( scripts.trust ))
8+
(( user.script ))\
9+
(( scripts.trust ))\
10+
(( trust.me ))\
11+
(( risk.it ))\
12+
(( marks.init ))\
13+
(( marks.protocol ))
914

1015
### color
1116

docs/guides/new_players/priv_store.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: priv_store
44

55
> Think of it as a secure account that scripts can't touch.
66
7-
_- Unknown, ((%Fmarks%.%Qlost_and_found%))_
7+
_- Unknown, ((marks.lost_and_found))_
88

99
((%Cpriv_store%)) is a special user that does not take a user slot, cannot be retired, and cannot run any scripts other than ((accts.balance)) or ((accts.xfer_gc_to)).
1010

src/css/custom.css

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,182 +115,237 @@ a.wikilink-new {
115115
background-size: 100% 4px;
116116
}
117117

118-
.color-tag[data-tag="a"] {
118+
.color-tag[data-tag="a"],
119+
.color-risk {
119120
color: #000000;
120121
}
122+
121123
.color-tag[data-tag="b"] {
122124
color: #3f3f3f;
123125
}
126+
124127
.color-tag[data-tag="c"] {
125128
color: #676767;
126129
}
130+
127131
.color-tag[data-tag="d"] {
128132
color: #7d0000;
129133
}
134+
130135
.color-tag[data-tag="e"] {
131136
color: #8e3434;
132137
}
138+
133139
.color-tag[data-tag="f"] {
134140
color: #a34f00;
135141
}
142+
136143
.color-tag[data-tag="g"] {
137144
color: #725437;
138145
}
146+
139147
.color-tag[data-tag="h"] {
140148
color: #a88600;
141149
}
150+
142151
.color-tag[data-tag="i"] {
143152
color: #b2934a;
144153
}
154+
145155
.color-tag[data-tag="j"] {
146156
color: #939500;
147157
}
158+
148159
.color-tag[data-tag="k"] {
149160
color: #495225;
150161
}
162+
151163
.color-tag[data-tag="l"] {
152164
color: #299400;
153165
}
166+
154167
.color-tag[data-tag="m"] {
155168
color: #23381b;
156169
}
170+
157171
.color-tag[data-tag="n"] {
158172
color: #00535b;
159173
}
174+
160175
.color-tag[data-tag="o"] {
161176
color: #324a4c;
162177
}
178+
163179
.color-tag[data-tag="p"] {
164180
color: #0073a6;
165181
}
182+
166183
.color-tag[data-tag="q"] {
167184
color: #385a6c;
168185
}
186+
169187
.color-tag[data-tag="r"] {
170188
color: #010067;
171189
}
190+
172191
.color-tag[data-tag="s"] {
173192
color: #507aa1;
174193
}
194+
175195
.color-tag[data-tag="t"] {
176196
color: #601c81;
177197
}
198+
178199
.color-tag[data-tag="u"] {
179200
color: #43314c;
180201
}
202+
181203
.color-tag[data-tag="v"] {
182204
color: #8c0069;
183205
}
206+
184207
.color-tag[data-tag="w"] {
185208
color: #973984;
186209
}
210+
187211
.color-tag[data-tag="x"] {
188212
color: #880024;
189213
}
214+
190215
.color-tag[data-tag="y"] {
191216
color: #762e4a;
192217
}
218+
193219
.color-tag[data-tag="z"] {
194220
color: #101215;
195221
}
222+
196223
.color-tag[data-tag="A"],
197224
.color-tag[data-tag="1"],
198-
.color-cli {
225+
.color-cli,
226+
.color-trust {
199227
color: #ffffff;
200228
}
229+
201230
.color-tag[data-tag="B"],
202231
.color-gc-text {
203232
color: #cacaca;
204233
}
234+
205235
.color-tag[data-tag="C"],
206236
.color-tag[data-tag="0"],
207237
.color-user,
208238
.color-gc-end {
209239
color: #9b9b9b;
210240
}
241+
211242
.color-tag[data-tag="D"],
212243
.color-gc-q {
213244
color: #ff0000;
214245
}
246+
215247
.color-tag[data-tag="E"] {
216248
color: #ff8383;
217249
}
250+
218251
.color-tag[data-tag="F"],
219-
.color-trust,
252+
.color-trust-user,
220253
.color-tag[data-tag="5"],
221254
.color-tag[data-tag="6"],
222255
.color-tag[data-tag="7"],
223256
.color-tag[data-tag="8"],
224257
.color-tag[data-tag="9"] {
225258
color: #ff8000;
226259
}
260+
227261
.color-tag[data-tag="G"] {
228262
color: #f3aa6f;
229263
}
264+
230265
.color-tag[data-tag="H"] {
231266
color: #fbc803;
232267
}
268+
233269
.color-tag[data-tag="I"] {
234270
color: #ffd863;
235271
}
272+
236273
.color-tag[data-tag="J"],
237274
.color-gc-b {
238275
color: #fff404;
239276
}
277+
240278
.color-tag[data-tag="K"] {
241279
color: #f3f998;
242280
}
281+
243282
.color-tag[data-tag="L"],
244283
.color-tag[data-tag="2"],
245284
.color-script,
246285
.color-gc-m {
247286
color: #1eff00;
248287
}
288+
249289
.color-tag[data-tag="M"] {
250290
color: #b3ff9b;
251291
}
292+
252293
.color-tag[data-tag="N"],
253294
.color-gc-k,
254295
.color-key {
255296
color: #00ffff;
256297
}
298+
257299
.color-tag[data-tag="O"] {
258300
color: #8fe6ff;
259301
}
302+
260303
.color-tag[data-tag="P"],
261304
.color-tag[data-tag="3"] {
262305
color: #0070dd;
263306
}
264-
.color-tag[data-tag="Q"] {
307+
308+
.color-tag[data-tag="Q"],
309+
.color-script-marks {
265310
color: #a4e3ff;
266311
}
312+
267313
.color-tag[data-tag="R"] {
268314
color: #0000ff;
269315
}
316+
270317
.color-tag[data-tag="S"] {
271318
color: #7ab2f4;
272319
}
320+
273321
.color-tag[data-tag="T"],
274-
.color-tag[data-tag="4"] {
322+
.color-tag[data-tag="4"],
323+
.color-script-risk {
275324
color: #b035ee;
276325
}
326+
277327
.color-tag[data-tag="U"] {
278328
color: #e6c4ff;
279329
}
330+
280331
.color-tag[data-tag="V"],
281332
.color-gc-t,
282333
.color-value {
283334
color: #ff00ec;
284335
}
336+
285337
.color-tag[data-tag="W"] {
286338
color: #ff96e0;
287339
}
340+
288341
.color-tag[data-tag="X"] {
289342
color: #ff0070;
290343
}
344+
291345
.color-tag[data-tag="Y"] {
292346
color: #ff6a98;
293347
}
348+
294349
.color-tag[data-tag="Z"] {
295350
color: #0c112b;
296351
}

src/plugins/rehype/autocolor.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ const trustUsers = [
1515
"market",
1616
"scripts",
1717
"sys",
18-
"trust",
18+
// "trust",
1919
"users",
2020
"marks",
2121
];
2222

23+
const marksTrustScripts = ["protocol", "available", "sync", "clone"];
24+
2325
// Matches (( <content > ))
2426
const regexAutocolorBlock = /\(\((.*?)\)\)/g;
2527

@@ -47,11 +49,28 @@ const regexGC =
4749
/(?=\d)(?:(\d+)Q)?(?:(\d{1,3})T)?(?:(\d{1,3})B)?(?:(\d{1,3})M)?(?:(\d{1,3})K)?(\d{1,3})?GC/g;
4850

4951
function colorScript(_fullMatch, user, script) {
50-
const isTrust = trustUsers.includes(user);
52+
const isTrustUser = trustUsers.includes(user);
53+
const isTrust = user == "trust";
54+
const isRisk = user == "risk";
55+
const isMarksScript = user == "marks" && !marksTrustScripts.includes(script);
56+
57+
const userColor = isTrustUser
58+
? "trust-user"
59+
: isTrust
60+
? "trust"
61+
: isRisk
62+
? "risk"
63+
: "user";
64+
const scriptColor = isRisk
65+
? "script-risk"
66+
: isMarksScript
67+
? "script-marks"
68+
: "script";
69+
5170
return [
52-
h("span", { class: `color-${isTrust ? "trust" : "user"}` }, user),
71+
h("span", { class: `color-${userColor}` }, user),
5372
u("text", "."),
54-
h("span", { class: "color-script" }, script),
73+
h("span", { class: `color-${scriptColor}` }, script),
5574
];
5675
}
5776

0 commit comments

Comments
 (0)