UI/Widgets/UIColorPopup.cs

A UI popup that shows a color picker tied to a SerializedProperty. It creates a ColorPickerControl child, assigns its Property, and renames any Label with text "Bright" to "#ui.color.brightness" for localization.

using Sandbox.UI;

namespace Sandbox;

public class UIColorPopup : Popup
{
	public UIColorPopup( Panel source, SerializedProperty property )
		: base( source, PositionMode.BelowLeft, 4f )
	{
		var picker = AddChild<ColorPickerControl>();
		picker.Property = property;

		// force rename "Bright" to "Brightness" and to let it be localized (hacky?)
		foreach ( var label in picker.Descendants.OfType<Label>() )
		{
			if ( label.Text == "Bright" ) label.Text = "#ui.color.brightness";
		}
	}
}