docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ColorWheel

    A customizable color wheel component for intuitive color selection in Unity UI applications.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ColorWheel
    Implements
    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    IInputElement<float>
    IValidatableElement<float>
    INotifyValueChanging<float>
    INotifyValueChanged<float>
    Inherited Members
    BaseVisualElement.contextPrefix
    BaseVisualElement.scaleOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.SetActivePseudoState(bool)
    VisualElement.SetCheckedPseudoState(bool)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.IsMarkedForRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.SetBinding(BindingId, Binding)
    VisualElement.GetBinding(BindingId)
    VisualElement.TryGetBinding(BindingId, out Binding)
    VisualElement.GetBindingInfos()
    VisualElement.GetBindingInfos(List<BindingInfo>)
    VisualElement.HasBinding(BindingId)
    VisualElement.ClearBinding(BindingId)
    VisualElement.ClearBindings()
    VisualElement.GetHierarchicalDataSourceContext()
    VisualElement.GetDataSourceContext(BindingId)
    VisualElement.TryGetDataSourceContext(BindingId, out DataSourceContext)
    VisualElement.TryGetLastBindingToUIResult(in BindingId, out BindingResult)
    VisualElement.TryGetLastBindingToSourceResult(in BindingId, out BindingResult)
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.disablePlayModeTint
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.scaledPixelsPerPoint
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.hasActivePseudoState
    VisualElement.hasInactivePseudoState
    VisualElement.hasHoverPseudoState
    VisualElement.hasCheckedPseudoState
    VisualElement.hasEnabledPseudoState
    VisualElement.hasDisabledPseudoState
    VisualElement.hasFocusPseudoState
    VisualElement.hasRootPseudoState
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.languageDirection
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.dataSource
    VisualElement.dataSourcePath
    VisualElement.dataSourceType
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.contentContainer
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.resolvedStyle
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, CallbackOptions)
    CallbackEventHandler.UnregisterAllRemovableCallbacks()
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    CallbackEventHandler.HandleEventBubbleUp(EventBase)
    CallbackEventHandler.HandleEventTrickleDown(EventBase)
    CallbackEventHandler.ExecuteDefaultAction(EventBase)
    CallbackEventHandler.NotifyPropertyChanged(in BindingId)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    [UxmlElement]
    public class ColorWheel : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<float>, IValidatableElement<float>, INotifyValueChanging<float>, INotifyValueChanged<float>
    Remarks

    The ColorWheel is an interactive component that enables users to select colors through a circular interface. It provides a natural and intuitive way to choose colors by rotating around the color spectrum.

    The component visualizes colors in a circular arrangement, with a draggable thumb that users can move to select different hues. The selected color is displayed in a swatch within the thumb indicator.

    In addition to hue selection through rotation, the ColorWheel supports customization of saturation, brightness, and opacity. It also features a configurable checkerboard background pattern to better visualize transparency.

    The inner radius should be kept between 0 and 0.5 (exclusive) to maintain proper wheel visualization and interaction.

    Examples

    Basic ColorWheel Setup

    Basic UXML setup for a color wheel with default settings.

    <ColorWheel value="0.0" saturation="1.0" brightness="1.0" opacity="1.0" style="width: 200px; height: 200px;"/>

    Custom ColorWheel with Modified Properties

    UXML setup for a color wheel with custom properties.

    <ColorWheel
        value="0.33"
        saturation="0.8"
        brightness="0.9"
        opacity="0.9"
        inner-radius="0.3"
        checker-size="8"
        style="width: 300px; height: 300px;"/>

    Code Example: Creating and Configuring a ColorWheel

    Creating a ColorWheel in code with event handling.

    var colorWheel = new ColorWheel
    {
        style = { width = 250, height = 250 },
        value = 0.5f,  // Start at cyan
        saturation = 0.9f,
        brightness = 1.0f,
        opacity = 0.95f,
        innerRadius = 0.35f
    };
    

    colorWheel.RegisterValueChangedCallback(evt => { Debug.Log($"Color changed to: "); });

    parentElement.Add(colorWheel);

    Constructors

    ColorWheel()

    Default constructor.

    Declaration
    public ColorWheel()

    Fields

    imageUssClassName

    The ColorWheel image styling class.

    Declaration
    public const string imageUssClassName = "appui-colorwheel__image"
    Field Value
    Type Description
    string

    thumbSwatchUssClassName

    The ColorWheel thumb swatch styling class.

    Declaration
    public const string thumbSwatchUssClassName = "appui-colorwheel__thumbswatch"
    Field Value
    Type Description
    string

    thumbUssClassName

    The ColorWheel thumb styling class.

    Declaration
    public const string thumbUssClassName = "appui-colorwheel__thumb"
    Field Value
    Type Description
    string

    ussClassName

    The ColorWheel main styling class.

    Declaration
    public const string ussClassName = "appui-colorwheel"
    Field Value
    Type Description
    string

    Properties

    brightness

    The brightness of the color wheel.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    [Range(0, 1)]
    public float brightness { get; set; }
    Property Value
    Type Description
    float

    checkerColor1

    The first color of the checkerboard pattern.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public Color checkerColor1 { get; set; }
    Property Value
    Type Description
    Color

    checkerColor2

    The second color of the checkerboard pattern.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public Color checkerColor2 { get; set; }
    Property Value
    Type Description
    Color

    checkerSize

    The size of the checkerboard pattern.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    [Min(0)]
    public int checkerSize { get; set; }
    Property Value
    Type Description
    int

    incrementFactor

    The factor by which the value is incremented when interacting with the wheel from the keyboard.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    [Min(1E-05)]
    public float incrementFactor { get; set; }
    Property Value
    Type Description
    float

    innerRadius

    The inner radius of the color wheel.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    [Range(0, 0.49999)]
    public float innerRadius { get; set; }
    Property Value
    Type Description
    float

    invalid

    The ColorWheel invalid state.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool invalid { get; set; }
    Property Value
    Type Description
    bool

    opacity

    The opacity of the color wheel. Note that a checkerboard pattern is always drawn behind the color wheel.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    [Range(0, 1)]
    public float opacity { get; set; }
    Property Value
    Type Description
    float

    saturation

    The saturation of the color wheel.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    [Range(0, 1)]
    public float saturation { get; set; }
    Property Value
    Type Description
    float

    selectedColor

    The currently selected color.

    Declaration
    [CreateProperty(ReadOnly = true)]
    public Color selectedColor { get; }
    Property Value
    Type Description
    Color

    validateValue

    The ColorWheel validation function.

    Declaration
    [CreateProperty]
    public Func<float, bool> validateValue { get; set; }
    Property Value
    Type Description
    Func<float, bool>

    value

    The hue value of the color wheel.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public float value { get; set; }
    Property Value
    Type Description
    float

    Methods

    SetValueWithoutNotify(float)

    Sets the value without sending any event.

    Declaration
    public void SetValueWithoutNotify(float newValue)
    Parameters
    Type Name Description
    float newValue

    The new value to set.

    Implements

    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    IInputElement<TValue>
    IValidatableElement<TValue>
    INotifyValueChanging<TValue>
    INotifyValueChanged<T>

    Extension Methods

    NotifyValueChangingExtensions.RegisterValueChangingCallback<TValue>(INotifyValueChanging<TValue>, EventCallback<ChangingEvent<TValue>>)
    NotifyValueChangingExtensions.UnregisterValueChangingCallback<TValue>(INotifyValueChanging<TValue>, EventCallback<ChangingEvent<TValue>>)
    VisualElementExtensions.FindNavController(VisualElement)
    RegisterUpdateCallbackExtensions.RegisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    RegisterUpdateCallbackExtensions.UnregisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    VisualElementExtensions.EnableDynamicTransform(VisualElement, bool)
    VisualElementExtensions.EnablePicking(VisualElement, bool)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContextProvider<T>(VisualElement, string)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement, string)
    VisualElementExtensions.GetExclusiveRootElement(VisualElement)
    VisualElementExtensions.GetLastAncestorOfType<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement, string)
    VisualElementExtensions.GetTooltipContent(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.HasAncestorOfType<T>(VisualElement, bool)
    VisualElementExtensions.HasAncestorsOfType<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement, string)
    VisualElementExtensions.IsInvisible(VisualElement)
    VisualElementExtensions.IsOnScreen(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, string, T)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipContent(VisualElement, VisualElementExtensions.TooltipContentCallback)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)