Color based on categorical vdim

I’m trying to make a hv.VSpans plot in which the color of the spans depends on some categorical value dimension (called phase in my example). When phase is of type int it works as expected, but in my case I would prefer phase to be str, but in that case the colors are the same for each category (see screenshot below).

One additional question, how could I specify the colors per category (i.e. by providing something like colors = {"growing": "red", "harvest": "green", etc...})?

import holoviews as hv
from holoviews import opts
import pandas as pd

df = pd.DataFrame({
    "start": [0, 6, 11, 15],
    "end": [6, 11, 15, 17],
    # "phase": [1, 2, 3, 1],
    "phase": ["growing", "harvest", "fallow", "growing"]
}
)

hv.VSpans(df, kdims = ["start", "end"], vdims = "phase").opts(
    opts.VSpans(tools = ["hover"], color = "phase", width = 500)
    )

Does this work for you?

import holoviews as hv

hv.extension("bokeh")

import holoviews as hv
from holoviews import opts
import pandas as pd

colors = {
    "growing": "green",
    "harvest": "orange",
    "fallow": "brown",
}

df = pd.DataFrame(
    {
        "start": [0, 6, 11, 15],
        "end": [6, 11, 15, 17],
        # "phase": [1, 2, 3, 1],
        "phase": ["growing", "harvest", "fallow", "growing"],
    }
)
df["color"] = df["phase"].map(colors)

hv.VSpans(df, kdims=["start", "end"], vdims=["phase", "color"]).opts(
    opts.VSpans(tools=["hover"], color="color", width=500)
)