RogueLibs' logo

Coloring a Custom Agent

Custom agents can be colored through the use of the Colors property available in the CustomAgent class. Notably, you can change the colors of individual limbs and body parts (unlike what vanilla SoR allows).

Setting colors

Usually, you would only define the colors only in the SetupAgent() method:

/MyAwesomeProject/MyAwesomeAgent.cs
public class MyAwesomeAgent : CustomAgent{    public override void SetupAgent()    {        /* ... */        Colors.Arm1Color = new Color32(105, 105, 105, 255);        Colors.Arm2Color = new Color32(230, 56, 10, 255);    }}
Pro-tip: Transparent sprites

Instead of turning off or destroying sprites that you don't need, set their transparency (alpha channel) to 0 instead. It's more reliable, as vanilla code is hard-coded to re-enable them constantly.

/MyAwesomeProject/MyAwesomeAgent.cs
public class MyAwesomeAgent : CustomAgent{    public override void SetupAgent()    {        /* ... */        Colors.EyesColor = new Color32(0, 0, 0, 0);        Colors.HairColor = new Color32(0, 0, 0, 0);    }}

Available color properties

Property nameDescription
HairColorThe color of the agent's hair. Overrides AgentHitbox.hairColor.
FacialHairColorThe color of the agent's facial hair. Overrides AgentHitbox.facialHairColor.
HeadColorThe color of the agent's head. Overrides AgentHitbox.skinColor.
EyesColorThe color of the agent's eyes. Overrides AgentHitbox.eyesColor.
BodyColorThe color of the agent's body. Overrides AgentHitbox.bodyColor.
Arm1ColorThe color of the agent's arm1. Overrides AgentHitbox.skinColor.
Arm2ColorThe color of the agent's arm2. Overrides AgentHitbox.skinColor.
Leg1ColorThe color of the agent's leg1. Overrides AgentHitbox.legsColor.
Leg2ColorThe color of the agent's leg2. Overrides AgentHitbox.legsColor.
FootwearColorThe color of the agent's footwear. Overrides AgentHitbox.footwearColor.
caution

Do not use original color fields, like AgentHitbox.hairColor, AgentHitbox.skinColor and etc. They're not gonna work on custom agents, since RogueLibs uses the colors from AgentColors instead.