8 bit rasters with color table can't use DATARANGE based on pixel value
What I can see, it is not possible to style a 8 bit raster with color table using DATARANGE based on the pixel value. The expression can be based on pixel value, but it always use the red component of the looked up color from the color table as range item.
It is quite common for the pixel value to contain the raster's information, e.g. slope, and the color table is just a style setting.
It would be great if RANGEITEM "pixel" could be used with 8 bit rasters. An alternative solution would be a processing directive that would tell MapServer to ignore the rasters color table and instead generate a default gray scale color table as done today for 8 bit rasters without color table.
CLASS
NAME "Slope <= 29°"
EXPRESSION ([pixel] >= 0 AND [pixel] <= 29)
STYLE
RANGEITEM "pixel"
COLORRANGE 255 255 255 55 55 55
DATARANGE 0 29
END # STYLE
END # CLASS
I have tested this with both MapServer 7.6.1 and 8.0.0.