[C#] Can't use type System.Drawing.Color

Dear FiveM community and team,

When trying to use System.Drawing.Color from the CitizenFx.Core namespace the compiler complains that the referenced assembly is not defined. The compiler suggests adding the following reference to the System.Drawing assembly:

System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

When trying to do so the compiler prints that the type Color exists in both CitizenFx.Core and System.Drawing.

We also tried using System.Drawing.Color by importing it like the following.

using Color = System.Drawing;

but this also resulted in the same error as stated above (with and without the reference to System.Drawing).`

Thanks in advance. :wave:

1 Like

I recall this was a little bit difficult to solve as something about type forwarding was acting up.

1 Like

We just found out it works in a different class even tho CitizenFx.Core and System.Drawing is being used
However we don’t know why yet the Imports seem to be the same and the class isn’t much different than the other

1 Like

Its very odd that when using

Game.PlayerPed.CurrentVehicle.Mods.CustomPrimaryColor = Color.FromArgb(x,x,x);

it works just fine and using

_timerbar.ForegroundColor = Color.FromArgb(x,x,x);

it doesn’t seem to work anymore…

2 Likes