Color
See the ColorDemo.cs.
using Gridrand.Contracts;
namespace Gridrand.RimGui.Manual
{
/// <summary>
/// Demonstrates the usage of colors and gradients in the GUI.
/// </summary>
class ColorDemo : ManualBase, IManual
{
readonly Color color = new Color(0f, 1f, 0f, 0.5f);
readonly Color32 color32 = new Color32(0, 100, 200, 128);
public ColorDemo(ManualBaseResource p) : base(p)
{
}
public void Draw()
{
// Draw solid colors
Gui.Heading("ColorPreview");
Gui.ColorPreview(color);
Gui.ColorPreview(color32);
// Draw gradient
Gui.Heading("Gradient");
// Previously, it was implemented as a widget, but it was changed because it was strange to implement it as a widget.
Gui.CustomDelegate(
static (shaper, widget) => shaper.AddGradient(widget.Rect, Color32.DarkRed, Color32.Black, Color32.DarkRed, Color32.Black),
true);
Gui.CustomDelegate(
static (shaper, widget) => shaper.AddGradient(widget.Rect, Color32.DarkBlue, Color32.Black, Color32.DarkBlue, Color32.Black),
true);
Gui.CustomDelegate(
static (shaper, widget) => shaper.AddGradient(widget.Rect, Color32.DarkGreen, Color32.Black, Color32.DarkGreen, Color32.Black),
true);
Gui.CustomDelegate(
static (shaper, widget) => shaper.AddGradient(widget.Rect, Color32.Gray, Color32.Black, Color32.Gray, Color32.Black),
true);
}
}
}