Home

How to dump customize styles?

I have a set, and I want to show the colors according to different conditions

Comments

  • You could use Util.Highlight() to change the color of the items you output. Or if you want more control, use Util.RawHtml().
    var colors = new[]
    {
        "red",
        "orange",
        "yellow",
        "green",
        "blue",
        "indigo",
        "violet",
    };
    colors.Select(c =>
        Util.Highlight($"The color {c}", c)
    ).Dump();
    colors.Select(c =>
        Util.RawHtml(
            new XElement("div",
                new XAttribute("style", $"color: {c};"),
                $"The color {c}"
            )
        )
    ).Dump();
Sign In or Register to comment.