color setting in inspector

Hey, I want a variable containing a color in my script but I want to be able to choose it in the inspector like in this picture

How can I create a variable like this in a script that works like a color but is setted in the inspector like this

Tyvm!!

// C#
public Color myColor;

// JavaScript
public var myColor : Color;

@alexanderameye

In Unity, when using C#, it is recommended to never use the ‘public’ prefix on fields at all.
Private fields should be private, obviously.
If you want to expose a field in the Inspector, use ‘[SerializeField] private’ as this won’t expose it to other scripts, just the inspector.
And if you want to open a field up to other scripts, use a public Property which you can control and sanitise to your heart’s content.