Open Johann150 opened 1 year ago
Oh I didn't see that issue. I guess that can be handled there separately then. The only thing that remains here is changing the default color of bg
then.
#xxx
#xxxx
#xxxxxx
#xxxxxxxx
γ«ε―ΎεΏγγγγͺγγ /^([0-9a-f]{3,4}){1,2}$/i
γγͺ
That will also match 7 digit ones which do not exist because the 3,4
part can be different on repetitions. I think the shortest you can get is this: /^(([0-9a-f]{3}){1,2}|([0-9a-f]{4}){1,2})$/i
/^([\da-f]{3}|([\da-f]{2}){2,4})$/i
Summary
In the rendering of
$[fg ]
and$[bg ]
, the default colors are#f00
for both. This means that if both functions are used on a piece of text, the text will have the same color as the background and will be unreadable. Maybe it would be better to have different default values for the two. For example, change thebg
default color to#0f0
.Further, I think the color regex incorrectly matches 4 and 5 digit color codes: https://github.com/misskey-dev/misskey/blob/fb54c58a661bee64365b7ec0c52d456062aaa200/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts#L208 Technically, 4 digit color codes do exist if you want to include the alpha channel, but then you should also accept 8 digit color codes. 5 digit color codes do not exist.
I suggest this alternative regex, which only matches 3 or 6 digit color codes:
/^([0-9a-f]{3}){1,2}$/i