@companion-module/base
    Preparing search index...

    Interface CompanionInputFieldColor<TKey>

    A colour picker input

    Available for actions/feedbacks/config Has three optional configuration properties:

    • {boolean} enableAlpha will show the colour picker with an additional alpha entry
    • {'string'|'number'} returnType do you want to get the results as CSS string or Companion color number
    • {string[]} presetColors replace the default swatch with your own colors when set
    {
    id: 'bg',
    type: 'colorpicker',
    label: 'Background color',
    default: 'rgb(255, 0, 0)'
    }
    {
    id: 'overlay',
    type: 'colorpicker',
    label: 'Overlay color',
    enableAlpha: true,
    returnType: 'string',
    default: 'rgba(100, 100, 255, 0.3)',
    presetColors: ['#000', '#ffffff', {color: 'rgba(255, 0, 0, 0.5)', title: 'semitransparent red'}]
    }
    interface CompanionInputFieldColor<TKey extends string = string> {
        allowInvalidValues?: boolean;
        default: string | number;
        description?: string;
        disableAutoExpression?: boolean;
        enableAlpha?: boolean;
        expressionDescription?: string;
        id: TKey;
        isVisibleExpression?: string;
        label: string;
        presetColors?: CompanionColorPresetValue[];
        returnType?: "string" | "number";
        tooltip?: string;
        type: "colorpicker";
    }

    Type Parameters

    • TKey extends string = string

    Hierarchy (View Summary)

    Index

    Properties

    allowInvalidValues?: boolean

    Enabling this will tell companion to validate the value of this field against the definition of the field. If the computed value for this option does not match the validation rules, it will be passed through unchanged. If this is not set, then any invalid value will result in the action/feedback being skipped entirely. Note: This only applies when in expression mode.

    default: string | number

    The default color value to set when creating this action/feedback/instance Can be a color string or a color number Valid strings are CSS color strings in Hex, RGB, HSL or HSV notation with or without alpha Valid numbers are 0x0 - 0xffffffff, where the components are ttrrggbb, you can generate the number with combineRgb()

    '#f00'
    '#ff0000'
    '#ff0000ff'
    'rgb(255,0,0)
    'rgba(255, 0, 0, 1.0)
    'hsl(0, 100, 50)'
    'hsv(0, 100, 100)'
    0xff0000
    description?: string

    A longer description/summary/notes for this field

    disableAutoExpression?: boolean

    Whether to disable support for toggling this field to be an expression Danger: Be careful if setting this to true for an existing option, if the user has already defined an expression for this, it will no longer be parsed and will break their configuration.

    enableAlpha?: boolean

    This will enable a alpha entry slider and input

    expressionDescription?: string

    An alternate description to show when the field is in expression mode. This will replace the normal description

    id: TKey

    The unique id of this input field within the input group

    isVisibleExpression?: string

    A companion expression to check whether this input should be visible, based on the current options selections within the input group

    This is the same syntax as other expressions written inside of Companion. You can access a value of the current options using $(options:some_field_id). Note: you can only reference fields which are set to disableAutoExpression here, as other fields can be expressions and frequently changing values

    label: string

    The label of the field

    presetColors?: CompanionColorPresetValue[]

    If set, this will override the default colors shown in the swatch. Enter an array of either color strings or objects with color strings and titles

    returnType?: "string" | "number"

    Specify if you want the colorpicker returning it's value as a CSS string or as a color number. This will also be the format stored in the database for this value

    tooltip?: string

    A hover tooltip for this field

    type: "colorpicker"

    The type of this input field