Yeah you would find how to do attribute like this in the mel reference as a example by the way.
1
2
3
4
5
6
7
{
$dir=directionalLight;
addAttr -longName myColor -usedAsColor -attributeType float3 $dir;
addAttr -ln myColorRed -sn mcr -attributeType "float" -parent myColor $dir;
addAttr -ln myColorGreen -sn mcg -attributeType "float" -parent myColor $dir;
addAttr -ln myColorBlue -sn mcb -attributeType "float" -parent myColor $dir;
}