If you are using graphics.library, pens are limited from 0-255, regardless of what your display is running on.
If you need to set an arbitrary colour for area pens for use on an RGB display, you need to use LoadRGB32 to set the colour of your chosen pen (or pens). On an RGB display, you can keep changing the pen colour without affecting already rendered pixels. On an indexed display, you have to worry about finding a suitable pen that is close to your desired colour in the first place.
Here's a bit of code from an old project:
void Draw2DAmiga::setPenRGB(Colour32 c, sint16 pen) // private
{
// sets the desired RGB value for a given pen index. For RGB modes only.
uint32 rgb32tab[] = {
1UL<<16|(pen&255),
(uint32)(c.red())<<24,
(uint32)(c.green())<<24,
(uint32)(c.blue())<<24,
0
};
// according to docs, this is faster than SetRGB32, even for 1 colour...
LoadRGB32(view, rgb32tab);
}