stop using premultiplied color for user selectable colors

This commit is contained in:
micycle 2023-05-23 22:11:16 -04:00 committed by yosh
parent d0867f30a9
commit 3f97a9f312
2 changed files with 9 additions and 5 deletions

View File

@ -448,7 +448,7 @@ namespace Celeste.Mod.AvaliSkin {
// hair flash right after dashing will be copied to the trail.
if (PlayerConfig.DashColorMode != DashColorMode.ExternalDash) {
// replace trail colors with marking colors
return PlayerConfig.GetColor(self);
return PlayerConfig.GetColor(self).Premultiply();
}
}
@ -464,7 +464,7 @@ namespace Celeste.Mod.AvaliSkin {
if (PlayerConfig.IsEnabled(self) && PlayerConfig.DashColorMode != DashColorMode.ExternalDash) {
// change player hair color to match dash colors.
// (hair is invisible, but that influences other things like the orbs when the Avali dies and respawns)
self.Hair.Color = PlayerConfig.GetColor(self);
self.Hair.Color = PlayerConfig.GetColor(self).Premultiply();
}
}
@ -481,7 +481,7 @@ namespace Celeste.Mod.AvaliSkin {
return orig(self);
}
Color color = PlayerConfig.GetColor(self);
Color color = PlayerConfig.GetColor(self).Premultiply();
// back up vanilla particles
ParticleType bakDashA = Player.P_DashA;

View File

@ -68,8 +68,12 @@ namespace Celeste.Mod.AvaliSkin {
}
float a = (float)(Calc.HexToByte(hex[6]) * 16 + Calc.HexToByte(hex[7])) / 255f;
// premultiply the alpha
return new Color(r, g, b) * a;
return new Color(r, g, b, a);
}
public static Color Premultiply(this Color color) {
return Color.FromNonPremultiplied(color.ToVector4());
}
}
}
}