Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ColorController

ColorController is the controller used to handle all different kind of colors.
It can take a lot of different format (HSL, RGB, HEX) and types (string, object, number)
This controller is build to keep the same input and output formats.

How to use

``` javascript const target = { colorHSL: { h: 1, s: 1, l: 1 }, colorHSLA: { h: 1, s: 1, l: 1, a: 0.4 }, colorHEX: "#FFFFFF", colorHEX2: 0xFFFFFF, colorRGB: {r: 1, g: 244, b: 1}, colorRGBA: {r: 1, g: 244, b: 1, a: 0.5}, colorRGBA: "rgba(255, 244, 122, 0.5)" }

// Method 1 group.add('colorHSL', target, { type: "color" }).on('update', (hslObject) => { console.log(hslObject.h) })

// Method 2 group.color('colorRGBA', target).on('update', (rgbaString) => { myElement.style.color = rgbaString })


For more information about options or events see <a href="BaseController.html">BaseController</a>

Hierarchy

Index

Constructors

Properties

listen: boolean = false

If true, the controller value will be updated automatically if target object is modified. Carefull: heavy use may reduce performance

group.add('someProperty', target, { listen: true })
disabled: boolean = false

If true, the controller will not be editable

name: string

Display name of a controller, defaultly equal to property.

group.add('someProperty', target, { name: 'Custom display name' })
property: string

property controlled in the target object

target: Object

source object in which the property key is defined

parent: BaseGroup

Methods

  • forceUpdate(): void
  • Manually update controller value in the form if target has changed

    Returns void

  • destroy(): void
  • Delete the controller

    Returns void

  • add(property: string, target?: Object, params?: any): void
  • Add a controller in the same Group of current controller

    Parameters

    • property: string
    • target: Object = undefined
    • params: any = undefined

    Returns void

  • valueOf(): any

Generated using TypeDoc