How to pass colors from xcolor in pgfplotsx?

Hi there, I am trying to pass color name from xcolor latex package, for example the “NavyBlue” color. However, it seems that “NavyBlue” or any other “special” color is not recognized:

Package xcolor Error: Undefined color `NavyBlue'.

Here is my test code:

@pgf Axis(
    {
        xlabel = "Cost",
        ylabel = "Error",
    },
    Plot(
        {
            color = "NavyBlue",
            mark  = "x"
        },
        Coordinates(
            [
                (2, -2.8559703),
                (3, -3.5301677),
                (4, -4.3050655),
                (5, -5.1413136),
                (6, -6.0322865),
                (7, -6.9675052),
                (8, -7.9377747),
            ]
        ),
    ),
)

Any idea how it can be solved?

By using the parse function, included in Colors package, and the @colorant_str macro the issue can be overcomes:

@pgf Axis(
    {
        xlabel = "Cost",
        ylabel = "Error",
    },
    Plot(
        {
            color = parse(Colorant, "NavyBlue")
            mark  = "x"
        },
        Coordinates(
            [
                (2, -2.8559703),
                (3, -3.5301677),
                (4, -4.3050655),
                (5, -5.1413136),
                (6, -6.0322865),
                (7, -6.9675052),
                (8, -7.9377747),
            ]
        ),
    ),
)