Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to create color pickers

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a new ColorPicker

    Parameters

    • Optional name: string

      defines the control name

    Returns ColorPicker

Properties

animations: Nullable<Animation[]>

Array of animations

hoverCursor: string

Gets or sets the cursor to use when the control is hovered

isFocusInvisible: boolean

Gets or sets a boolean indicating if the control can be focusable

isHitTestVisible: boolean

Gets or sets a boolean indicating if the control can be hit with pointer events

isPointerBlocker: boolean

Gets or sets a boolean indicating if the control can block pointer events. False by default except on the following controls:

  • Button controls (Button, RadioButton, ToggleButton)
  • Checkbox
  • ColorPicker
  • InputText
  • Slider
metadata: any

Gets or sets an object used to store user defined information for the node

name?: string

defines the name of the control

onAccessibilityTagChangedObservable: Observable<Nullable<IAccessibilityTag>>
onAfterDrawObservable: Observable<Control>

An event triggered after the control was drawn

onBeforeDrawObservable: Observable<Control>

An event triggered before drawing the control

onDirtyObservable: Observable<Control>

An event triggered when the control is marked as dirty

onDisposeObservable: Observable<Control>

An event triggered when the control has been disposed

onIsVisibleChangedObservable: Observable<boolean>

An event triggered when the control isVisible is changed

onPointerClickObservable: Observable<Vector2WithInfo>

An event triggered when a control is clicked on

onPointerDownObservable: Observable<Vector2WithInfo>

An event triggered when the pointer taps the control

onPointerEnterObservable: Observable<Control>

An event triggered when pointer enters the control

onPointerMoveObservable: Observable<Vector2>

An event triggered when the pointer moves over the control.

onPointerOutObservable: Observable<Control>

An event triggered when the pointer moves out of the control.

onPointerUpObservable: Observable<Vector2WithInfo>

An event triggered when pointer up

onValueChangedObservable: Observable<Color3>

BABYLON.Observable raised when the value changes

onWheelObservable: Observable<Vector2>

An event triggered when pointer wheel is scrolled

overlapDeltaMultiplier?: number

Gets/sets the deoverlap movement multiplier

overlapGroup?: number

Gets/sets the overlap group of the control. Controls with overlapGroup set to a number can be deoverlapped. Controls with overlapGroup set to undefined are not deoverlapped.

see

https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#deoverlapping

Gets or sets the control parent

uniqueId: number

Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container

useBitmapCache: boolean

Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)

AddHeader: ((control: Control, text: string, size: string | number, options: { controlFirst: boolean; isHorizontal: boolean }) => any)

Type declaration

    • (control: Control, text: string, size: string | number, options: { controlFirst: boolean; isHorizontal: boolean }): any
    • Parameters

      • control: Control
      • text: string
      • size: string | number
      • options: { controlFirst: boolean; isHorizontal: boolean }
        • controlFirst: boolean
        • isHorizontal: boolean

      Returns any

AllowAlphaInheritance: boolean

Gets or sets a boolean indicating if alpha must be an inherited value (false by default)

Accessors

  • Gets or sets the accessibility tag to describe the control for accessibility purpose. By default, GUI controls already indicate accessibility info, but one can override the info using this tag.

    Returns Nullable<IAccessibilityTag>

  • Gets or sets the accessibility tag to describe the control for accessibility purpose. By default, GUI controls already indicate accessibility info, but one can override the info using this tag.

    Parameters

    Returns void

  • get alpha(): number
  • set alpha(value: number): void
  • Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent)

    Returns number

  • Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent)

    Parameters

    • value: number

    Returns void

  • get centerX(): number
  • Gets the center coordinate on X axis

    Returns number

  • get centerY(): number
  • Gets the center coordinate on Y axis

    Returns number

  • get clipChildren(): boolean
  • set clipChildren(value: boolean): void
  • Sets/Gets a boolean indicating if the children are clipped to the current control bounds. Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children

    Returns boolean

  • Sets/Gets a boolean indicating if the children are clipped to the current control bounds. Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children

    Parameters

    • value: boolean

    Returns void

  • get clipContent(): boolean
  • set clipContent(value: boolean): void
  • Sets/Gets a boolean indicating that control content must be clipped Please note that not clipping content may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children

    Returns boolean

  • Sets/Gets a boolean indicating that control content must be clipped Please note that not clipping content may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children

    Parameters

    • value: boolean

    Returns void

  • get color(): string
  • set color(value: string): void
  • Gets or sets foreground color

    Returns string

  • Gets or sets foreground color

    Parameters

    • value: string

    Returns void

  • get descendantsOnlyPadding(): boolean
  • set descendantsOnlyPadding(value: boolean): void
  • Gets or sets a value indicating the padding should work like in CSS. Basically, it will add the padding amount on each side of the parent control for its children.

    Returns boolean

  • Gets or sets a value indicating the padding should work like in CSS. Basically, it will add the padding amount on each side of the parent control for its children.

    Parameters

    • value: boolean

    Returns void

  • get disabledColor(): string
  • set disabledColor(value: string): void
  • Gets or sets background color of control if it's disabled. Only applies to Button class.

    Returns string

  • Gets or sets background color of control if it's disabled. Only applies to Button class.

    Parameters

    • value: string

    Returns void

  • get disabledColorItem(): string
  • set disabledColorItem(value: string): void
  • Gets or sets front color of control if it's disabled. Only applies to Checkbox class.

    Returns string

  • Gets or sets front color of control if it's disabled. Only applies to Checkbox class.

    Parameters

    • value: string

    Returns void

  • get fixedRatio(): number
  • set fixedRatio(value: number): void
  • Gets or sets a fixed ratio for this control. When different from 0, the ratio is used to compute the "second" dimension. The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the second dimension is computed as first dimension * fixedRatio

    Returns number

  • Parameters

    • value: number

    Returns void

  • get fixedRatioMasterIsWidth(): boolean
  • set fixedRatioMasterIsWidth(value: boolean): void
  • Gets or sets a boolean indicating that the fixed ratio is set on the width instead of the height. True by default. When the height of a control is set, this property is changed to false.

    Returns boolean

  • Parameters

    • value: boolean

    Returns void

  • get fontFamily(): string
  • set fontFamily(value: string): void
  • Gets or set font family

    Returns string

  • Gets or set font family

    Parameters

    • value: string

    Returns void

  • get fontOffset(): { ascent: number; descent: number; height: number }
  • set fontOffset(offset: { ascent: number; descent: number; height: number }): void
  • Gets or set information about font offsets (used to render and align text)

    Returns { ascent: number; descent: number; height: number }

    • ascent: number
    • descent: number
    • height: number
  • Gets or set information about font offsets (used to render and align text)

    Parameters

    • offset: { ascent: number; descent: number; height: number }
      • ascent: number
      • descent: number
      • height: number

    Returns void

  • get fontSize(): string | number
  • set fontSize(value: string | number): void
  • Gets or sets font size

    Returns string | number

  • Gets or sets font size

    Parameters

    • value: string | number

    Returns void

  • get fontSizeInPixels(): number
  • set fontSizeInPixels(value: number): void
  • Gets or sets font size in pixels

    Returns number

  • Gets or sets font size in pixels

    Parameters

    • value: number

    Returns void

  • get fontStyle(): string
  • set fontStyle(value: string): void
  • Gets or sets font style

    Returns string

  • Gets or sets font style

    Parameters

    • value: string

    Returns void

  • get fontWeight(): string
  • set fontWeight(value: string): void
  • Gets or sets font weight

    Returns string

  • Gets or sets font weight

    Parameters

    • value: string

    Returns void

  • Gets or sets gradient. Setting a gradient will override the color

    Returns Nullable<BaseGradient>

  • Gets or sets gradient. Setting a gradient will override the color

    Parameters

    Returns void

  • get height(): string | number
  • set height(value: string | number): void
  • get heightInPixels(): number
  • set heightInPixels(value: number): void
  • get highlightColor(): string
  • set highlightColor(value: string): void
  • Gets or sets a string defining the color to use for highlighting this control

    Returns string

  • Gets or sets a string defining the color to use for highlighting this control

    Parameters

    • value: string

    Returns void

  • get highlightLineWidth(): number
  • set highlightLineWidth(value: number): void
  • Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)

    Returns number

  • Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)

    Parameters

    • value: number

    Returns void

  • get horizontalAlignment(): number
  • set horizontalAlignment(value: number): void
  • Get the hosting AdvancedDynamicTexture

    Returns AdvancedDynamicTexture

  • get isDirty(): boolean
  • Gets a boolean indicating that the control needs to update its rendering

    Returns boolean

  • get isEnabled(): boolean
  • set isEnabled(value: boolean): void
  • Gets or sets if control is Enabled

    Returns boolean

  • Gets or sets if control is Enabled

    Parameters

    • value: boolean

    Returns void

  • get isHighlighted(): boolean
  • set isHighlighted(value: boolean): void
  • Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)

    Returns boolean

  • Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)

    Parameters

    • value: boolean

    Returns void

  • get isReadOnly(): boolean
  • set isReadOnly(value: boolean): void
  • Gets or sets a boolean indicating if the control is readonly (default: false). A readonly control will still raise pointer events but will not react to them

    Returns boolean

  • Gets or sets a boolean indicating if the control is readonly (default: false). A readonly control will still raise pointer events but will not react to them

    Parameters

    • value: boolean

    Returns void

  • get isVisible(): boolean
  • set isVisible(value: boolean): void
  • Gets or sets a boolean indicating if the control is visible

    Returns boolean

  • Gets or sets a boolean indicating if the control is visible

    Parameters

    • value: boolean

    Returns void

  • get left(): string | number
  • set left(value: string | number): void
  • get leftInPixels(): number
  • set leftInPixels(value: number): void
  • get linkOffsetX(): string | number
  • set linkOffsetX(value: string | number): void
  • get linkOffsetXInPixels(): number
  • set linkOffsetXInPixels(value: number): void
  • get linkOffsetY(): string | number
  • set linkOffsetY(value: string | number): void
  • get linkOffsetYInPixels(): number
  • set linkOffsetYInPixels(value: number): void
  • Gets the current linked mesh (or null if none)

    Returns Nullable<TransformNode>

  • get notRenderable(): boolean
  • set notRenderable(value: boolean): void
  • Gets or sets a boolean indicating if the control can be rendered

    Returns boolean

  • Gets or sets a boolean indicating if the control can be rendered

    Parameters

    • value: boolean

    Returns void

  • get paddingBottom(): string | number
  • set paddingBottom(value: string | number): void
  • get paddingBottomInPixels(): number
  • set paddingBottomInPixels(value: number): void
  • get paddingLeft(): string | number
  • set paddingLeft(value: string | number): void
  • get paddingLeftInPixels(): number
  • set paddingLeftInPixels(value: number): void
  • get paddingRight(): string | number
  • set paddingRight(value: string | number): void
  • get paddingRightInPixels(): number
  • set paddingRightInPixels(value: number): void
  • get paddingTop(): string | number
  • set paddingTop(value: string | number): void
  • get paddingTopInPixels(): number
  • set paddingTopInPixels(value: number): void
  • get rotation(): number
  • set rotation(value: number): void
  • get scaleX(): number
  • set scaleX(value: number): void
  • get scaleY(): number
  • set scaleY(value: number): void
  • get shadowBlur(): number
  • set shadowBlur(value: number): void
  • Gets or sets a value indicating the amount of blur to use to render the shadow

    Returns number

  • Gets or sets a value indicating the amount of blur to use to render the shadow

    Parameters

    • value: number

    Returns void

  • get shadowColor(): string
  • set shadowColor(value: string): void
  • Gets or sets a value indicating the color of the shadow (black by default ie. "#000")

    Returns string

  • Gets or sets a value indicating the color of the shadow (black by default ie. "#000")

    Parameters

    • value: string

    Returns void

  • get shadowOffsetX(): number
  • set shadowOffsetX(value: number): void
  • Gets or sets a value indicating the offset to apply on X axis to render the shadow

    Returns number

  • Gets or sets a value indicating the offset to apply on X axis to render the shadow

    Parameters

    • value: number

    Returns void

  • get shadowOffsetY(): number
  • set shadowOffsetY(value: number): void
  • Gets or sets a value indicating the offset to apply on Y axis to render the shadow

    Returns number

  • Gets or sets a value indicating the offset to apply on Y axis to render the shadow

    Parameters

    • value: number

    Returns void

  • get size(): string | number
  • set size(value: string | number): void
  • Gets or sets control size

    Returns string | number

  • Gets or sets control size

    Parameters

    • value: string | number

    Returns void

  • get top(): string | number
  • set top(value: string | number): void
  • get topInPixels(): number
  • set topInPixels(value: number): void
  • get transformCenterX(): number
  • set transformCenterX(value: number): void
  • get transformCenterY(): number
  • set transformCenterY(value: number): void
  • Gets the transformed measure, that is the bounding box of the control after applying all transformations

    Returns Measure

  • get typeName(): string
  • Gets the control type name

    Returns string

  • Gets or sets the color of the color picker

    Returns Color3

  • Gets or sets the color of the color picker

    Parameters

    Returns void

  • get verticalAlignment(): number
  • set verticalAlignment(value: number): void
  • get width(): string | number
  • set width(value: string | number): void
  • get widthInPixels(): number
  • set widthInPixels(value: number): void
  • get zIndex(): number
  • set zIndex(value: number): void
  • Gets or sets z index which is used to reorder controls on the z axis

    Returns number

  • Gets or sets z index which is used to reorder controls on the z axis

    Parameters

    • value: number

    Returns void

  • get HORIZONTAL_ALIGNMENT_CENTER(): number
  • HORIZONTAL_ALIGNMENT_CENTER

    Returns number

  • get HORIZONTAL_ALIGNMENT_LEFT(): number
  • HORIZONTAL_ALIGNMENT_LEFT

    Returns number

  • get HORIZONTAL_ALIGNMENT_RIGHT(): number
  • HORIZONTAL_ALIGNMENT_RIGHT

    Returns number

  • get VERTICAL_ALIGNMENT_BOTTOM(): number
  • VERTICAL_ALIGNMENT_BOTTOM

    Returns number

  • get VERTICAL_ALIGNMENT_CENTER(): number
  • VERTICAL_ALIGNMENT_CENTER

    Returns number

  • get VERTICAL_ALIGNMENT_TOP(): number
  • VERTICAL_ALIGNMENT_TOP

    Returns number

Methods

  • _onCanvasBlur(): void
  • Returns void

  • Parameters

    Returns boolean

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Clones a control and its descendants

    Parameters

    • Optional host: AdvancedDynamicTexture

      the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture

    Returns Control

    the cloned control

  • contains(x: number, y: number): boolean
  • Tests if a given coordinates belong to the current control

    Parameters

    • x: number

      defines x coordinate to test

    • y: number

      defines y coordinate to test

    Returns boolean

    true if the coordinates are inside the control

  • dispose(): void
  • Releases associated resources

    Returns void

  • Gets the first ascendant in the hierarchy of the given type

    Parameters

    • className: string

      defines the required type

    Returns Nullable<Control>

    the ascendant or null if not found

  • getClassName(): string
  • Get the current class name of the control.

    Returns string

    current class name

  • getDescendants(directDescendantsOnly?: boolean, predicate?: ((control: Control) => boolean)): Control[]
  • Will return all controls that have this control as ascendant

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: ((control: Control) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns Control[]

    all child controls

  • getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: ((control: Control) => boolean)): void
  • Will store all controls that have this control as ascendant in a given array

    Parameters

    • results: Control[]

      defines the array where to store the descendants

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: ((control: Control) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns void

  • Gets coordinates in local control space

    Parameters

    • globalCoordinates: Vector2

      defines the coordinates to transform

    Returns Vector2

    the new coordinates in local space

  • Gets coordinates in local control space

    Parameters

    • globalCoordinates: Vector2

      defines the coordinates to transform

    • result: Vector2

      defines the target vector2 where to store the result

    Returns Control

    the current control

  • Gets coordinates in parent local control space

    Parameters

    • globalCoordinates: Vector2

      defines the coordinates to transform

    Returns Vector2

    the new coordinates in parent local space

  • isAscendant(container: Control): boolean
  • Determines if a container is an ascendant of the current control

    Parameters

    • container: Control

      defines the container to look for

    Returns boolean

    true if the container is one of the ascendant of the control

  • isReady(): boolean
  • Returns true if the control is ready to be used

    Returns boolean

  • markAllAsDirty(): void
  • Mark the element and its children as dirty

    Returns void

  • markAsDirty(force?: boolean): void
  • Mark control element as dirty

    Parameters

    • Optional force: boolean

      force non visible elements to be marked too

    Returns void

  • Move the current control to a vector3 position projected onto the screen.

    Parameters

    • position: Vector3

      defines the target position

    • scene: Scene

      defines the hosting scene

    Returns void

  • Parses a serialized object into this control

    Parameters

    • serializedObject: any

      the object with the serialized properties

    • Optional host: AdvancedDynamicTexture

      the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture

    Returns Control

    this control

  • serialize(serializationObject: any): void
  • Serializes the current control

    Parameters

    • serializationObject: any

      defined the JSON serialized object

    Returns void

  • setPadding(paddingTop: string | number, paddingRight?: string | number, paddingBottom?: string | number, paddingLeft?: string | number): void
  • Shorthand function to set the top, right, bottom, and left padding values on the control.

    see

    https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size

    Parameters

    • paddingTop: string | number

      The value of the top padding.

    • Optional paddingRight: string | number

      The value of the right padding. If omitted, top is used.

    • Optional paddingBottom: string | number

      The value of the bottom padding. If omitted, top is used.

    • Optional paddingLeft: string | number

      The value of the left padding. If omitted, right is used.

    Returns void

  • setPaddingInPixels(paddingTop: number, paddingRight?: number, paddingBottom?: number, paddingLeft?: number): void
  • Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.

    see

    https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size

    Parameters

    • paddingTop: number

      The value in pixels of the top padding.

    • Optional paddingRight: number

      The value in pixels of the right padding. If omitted, top is used.

    • Optional paddingBottom: number

      The value in pixels of the bottom padding. If omitted, top is used.

    • Optional paddingLeft: number

      The value in pixels of the left padding. If omitted, right is used.

    Returns void

  • Creates a Control from parsed data

    Parameters

    • serializedObject: any

      defines parsed data

    • host: AdvancedDynamicTexture

      defines the hosting AdvancedDynamicTexture

    Returns Control

    a new Control

  • ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: { headerHeight?: string; lastColor?: string; numSwatchesPerLine?: number; pickerHeight?: string; pickerWidth?: string; savedColors?: string[]; swatchLimit?: number }): Promise<{ pickedColor: string; savedColors?: string[] }>
  • This function expands the color picker by creating a color picker dialog with manual color value input and the ability to save colors into an array to be used later in subsequent launches of the dialogue.

    Parameters

    • advancedTexture: AdvancedDynamicTexture

      defines the AdvancedDynamicTexture the dialog is assigned to

    • options: { headerHeight?: string; lastColor?: string; numSwatchesPerLine?: number; pickerHeight?: string; pickerWidth?: string; savedColors?: string[]; swatchLimit?: number }

      defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.

      • Optional headerHeight?: string
      • Optional lastColor?: string
      • Optional numSwatchesPerLine?: number
      • Optional pickerHeight?: string
      • Optional pickerWidth?: string
      • Optional savedColors?: string[]
      • Optional swatchLimit?: number

    Returns Promise<{ pickedColor: string; savedColors?: string[] }>

    picked color as a hex string and the saved colors array as hex strings.

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static method

Settings

Theme