def get_hs_extent(xarr, is_color_image=False):
    """
    Read the "XY" coordinates of an xarray.DataArray to set extent of image for
    imshow.

    Parameters
    ----------

    xarr : xarray.DataArray
        DataArray being viewed with hyperslicer

    is_color_image : bool, default False
        Whether the individual images of the hyperstack are color images.

    Returns
    -------
    extent : list
        Extent argument for imshow. [d0_min, d0_max, d1_min, d1_max]

    """

    if not is_color_image:
        dims = xarr.dims[-2:]
    else:
        dims = xarr.dims[-3:-1]
    extent = []
    for d in dims:
        vals = xarr[d].values
        extent.append(vals.min())
        extent.append(vals.max())
    return extent