diff --git a/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs b/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs index 7856aec9..3e276174 100644 --- a/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs +++ b/Iceshrimp.Frontend/Core/Miscellaneous/RenderMfm.cs @@ -273,8 +273,8 @@ public static class MfmRenderer "crop" => MfmFnCrop(args, document), "position" => MfmFnPosition(args, document), "scale" => MfmFnScale(args, document), - "fg" => throw new NotImplementedException($"{node.Name}"), - "bg" => throw new NotImplementedException($"{node.Name}"), + "fg" => MfmFnFg(args, document), + "bg" => MfmFnBg(args, document), "border" => throw new NotImplementedException($"{node.Name}"), "ruby" => throw new NotImplementedException($"{node.Name}"), "unixtime" => throw new NotImplementedException($"{node.Name}"), @@ -377,4 +377,24 @@ public static class MfmRenderer return el; } + + private static INode MfmFnFg(Dictionary args, IDocument document) + { + var el = document.CreateElement("span"); + + if (args.TryGetValue("color", out var color)) + el.SetAttribute("style", $"color: #{color};"); + + return el; + } + + private static INode MfmFnBg(Dictionary args, IDocument document) + { + var el = document.CreateElement("span"); + + if (args.TryGetValue("color", out var color)) + el.SetAttribute("style", $"background-color: #{color};"); + + return el; + } } \ No newline at end of file