[frontend/mfm] Implement fg and bg fn nodes
This commit is contained in:
parent
5d6e1d841f
commit
90511c7b58
1 changed files with 22 additions and 2 deletions
|
@ -273,8 +273,8 @@ public static class MfmRenderer
|
||||||
"crop" => MfmFnCrop(args, document),
|
"crop" => MfmFnCrop(args, document),
|
||||||
"position" => MfmFnPosition(args, document),
|
"position" => MfmFnPosition(args, document),
|
||||||
"scale" => MfmFnScale(args, document),
|
"scale" => MfmFnScale(args, document),
|
||||||
"fg" => throw new NotImplementedException($"{node.Name}"),
|
"fg" => MfmFnFg(args, document),
|
||||||
"bg" => throw new NotImplementedException($"{node.Name}"),
|
"bg" => MfmFnBg(args, document),
|
||||||
"border" => throw new NotImplementedException($"{node.Name}"),
|
"border" => throw new NotImplementedException($"{node.Name}"),
|
||||||
"ruby" => throw new NotImplementedException($"{node.Name}"),
|
"ruby" => throw new NotImplementedException($"{node.Name}"),
|
||||||
"unixtime" => throw new NotImplementedException($"{node.Name}"),
|
"unixtime" => throw new NotImplementedException($"{node.Name}"),
|
||||||
|
@ -377,4 +377,24 @@ public static class MfmRenderer
|
||||||
|
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static INode MfmFnFg(Dictionary<string, string?> 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<string, string?> args, IDocument document)
|
||||||
|
{
|
||||||
|
var el = document.CreateElement("span");
|
||||||
|
|
||||||
|
if (args.TryGetValue("color", out var color))
|
||||||
|
el.SetAttribute("style", $"background-color: #{color};");
|
||||||
|
|
||||||
|
return el;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue