mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-05-11 03:06:55 +00:00
Revert MicronParser.js truecolor support for now
This commit is contained in:
@@ -755,18 +755,6 @@ class MicronParser {
|
||||
break;
|
||||
|
||||
case "F":
|
||||
if (line[i + 4] === "`" && line[i + 5] === "F" && line.length >= i + 9) {
|
||||
let color = line[i+6]+line[i+1]+line[i+7]+line[i+2]+line[i+8]+line[i+3];
|
||||
state.fg_color = color;
|
||||
skip = 8;
|
||||
break;
|
||||
}
|
||||
if (line[i + 1] === "T" && line.length >= i + 8) {
|
||||
let color = line.substr(i + 2, 6);
|
||||
state.fg_color = color;
|
||||
skip = 7;
|
||||
break;
|
||||
}
|
||||
if (line.length >= i + 4) {
|
||||
let color = line.substr(i + 1, 3);
|
||||
state.fg_color = color;
|
||||
@@ -778,20 +766,6 @@ class MicronParser {
|
||||
state.fg_color = state.default_fg;
|
||||
break;
|
||||
case "B":
|
||||
if (line[i + 4] === "`" && line[i + 5] === "B" && line.length >= i + 9) {
|
||||
let color = line[i+6]+line[i+1]+line[i+7]+line[i+2]+line[i+8]+line[i+3];
|
||||
state.bg_color = color;
|
||||
skip = 8;
|
||||
flushPart();
|
||||
break;
|
||||
}
|
||||
if (line[i + 1] === "T" && line.length >= i + 8) {
|
||||
let color = line.substr(i + 2, 6);
|
||||
state.bg_color = color;
|
||||
skip = 7;
|
||||
flushPart();
|
||||
break;
|
||||
}
|
||||
if (line.length >= i + 4) {
|
||||
let color = line.substr(i + 1, 3);
|
||||
state.bg_color = color;
|
||||
|
||||
@@ -102,34 +102,6 @@ describe("MicronParser.js", () => {
|
||||
expect(html).toContain("rgb(170, 187, 204)");
|
||||
expect(html).toContain("Red Text");
|
||||
});
|
||||
|
||||
it("handles FT truecolor (6-char hex)", () => {
|
||||
const markup = "`FTff00ffMagenta Text`";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(255, 0, 255)");
|
||||
expect(html).toContain("Magenta Text");
|
||||
});
|
||||
|
||||
it("prefers FT over F when both could match", () => {
|
||||
const markup = "`FTabcdefText`";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(171, 205, 239)");
|
||||
expect(html).toContain("Text");
|
||||
});
|
||||
|
||||
it("handles fallback truecolor for NomadNet compat (Fbdf`Face)", () => {
|
||||
const markup = "`Fbdf`FaceColored Text";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(171, 205, 239)");
|
||||
expect(html).toContain("Colored Text");
|
||||
});
|
||||
|
||||
it("fallback truecolor takes priority over plain 3-char F", () => {
|
||||
const markup = "`Ff00`F0ffColored Text";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(15, 240, 240)");
|
||||
expect(html).toContain("Colored Text");
|
||||
});
|
||||
});
|
||||
|
||||
describe("background color", () => {
|
||||
@@ -139,34 +111,6 @@ describe("MicronParser.js", () => {
|
||||
expect(html).toContain("rgb(255, 255, 255)");
|
||||
expect(html).toContain("Yellow BG");
|
||||
});
|
||||
|
||||
it("handles BT truecolor (6-char hex)", () => {
|
||||
const markup = "`BT0000ffBlue BG`";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(0, 0, 255)");
|
||||
expect(html).toContain("Blue BG");
|
||||
});
|
||||
|
||||
it("prefers BT over B when both could match", () => {
|
||||
const markup = "`BT112233Text`";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(17, 34, 51)");
|
||||
expect(html).toContain("Text");
|
||||
});
|
||||
|
||||
it("handles fallback truecolor for NomadNet compat (Bbdf`Bace)", () => {
|
||||
const markup = "`Bbdf`BaceYellow BG";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(171, 205, 239)");
|
||||
expect(html).toContain("Yellow BG");
|
||||
});
|
||||
|
||||
it("fallback truecolor takes priority over plain 3-char B", () => {
|
||||
const markup = "`Bf00`B0ffBG Text";
|
||||
const html = parser.convertMicronToHtml(markup);
|
||||
expect(html).toContain("rgb(15, 240, 240)");
|
||||
expect(html).toContain("BG Text");
|
||||
});
|
||||
});
|
||||
|
||||
it("handles literal mode", () => {
|
||||
|
||||
Reference in New Issue
Block a user