Class ColorSwatch
A color swatch is a visual element that displays a color or a gradient.
Implements
INotifyValueChanged<Gradient>
Inherited Members
VisualElement.ExecuteDefaultAction(EventBase)
VisualElement.Focus()
VisualElement.Overlaps(Rect)
VisualElement.ToString()
VisualElement.GetFirstOfType<T>()
VisualElement.GetFirstAncestorOfType<T>()
VisualElement.canGrabFocus
VisualElement.focusController
VisualElement.cacheAsBitmap
CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class ColorSwatch : BaseVisualElement, IEventHandler, IVisualElementScheduler, IExperimentalFeatures, ITransitionAnimations, ITransform, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, INotifyValueChanged<Gradient>, ISizeableElement
Constructors
ColorSwatch()
Default Constructor.
Declaration
public ColorSwatch()
Fields
imageUssClassName
The ColorSwatch image styling class.
Declaration
public const string imageUssClassName = "appui-colorswatch__image"
Field Value
Type | Description |
---|---|
string |
roundUssClassName
The ColorSwatch round styling class.
Declaration
public const string roundUssClassName = "appui-colorswatch--round"
Field Value
Type | Description |
---|---|
string |
sizeUssClassName
The ColorSwatch size styling class.
Declaration
public const string sizeUssClassName = "appui-colorswatch--size-"
Field Value
Type | Description |
---|---|
string |
ussClassName
The ColorSwatch main styling class.
Declaration
public const string ussClassName = "appui-colorswatch"
Field Value
Type | Description |
---|---|
string |
Properties
color
The single color of the ColorSwatch. Setting this property will overwrite the current gradient value to contain only the given single color value. The property's getter always return the first item of the gradient.
Declaration
public Color color { get; set; }
Property Value
Type | Description |
---|---|
Color |
round
Round variant of the ColorSwatch.
Declaration
public bool round { get; set; }
Property Value
Type | Description |
---|---|
bool |
size
The size of the ColorSwatch element.
Declaration
public Size size { get; set; }
Property Value
Type | Description |
---|---|
Size |
value
The color entry list.
Declaration
public Gradient value { get; set; }
Property Value
Type | Description |
---|---|
Gradient |
Methods
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
Type | Name | Description |
---|---|---|
Size | enumValue |
Returns
Type | Description |
---|---|
string |
Refresh()
Force the refresh of the visual element.
Declaration
public void Refresh()
SetValueWithoutNotify(Gradient)
Set the color entry list value, without being notified of any changes.
Declaration
public void SetValueWithoutNotify(Gradient newValue)
Parameters
Type | Name | Description |
---|---|---|
Gradient | newValue | The new color entry list. |
Implements
UnityEngine.UIElements.INotifyValueChanged<T>