Color
A color picker.
Wraps Tweakpane's color input binding.
<Color> is a dynamic component: the alpha prop is only available when value is a number, and
the type prop is only available when value is an object or tuple. (Other value types carry
their own alpha and type information.)
Usage outside of a <Pane> component will implicitly wrap the color picker in <Pane position="inline">.
Example
Section titled “Example”<script lang="ts"> import { Color } from 'svelte-tweakpane-ui'
let startColor = '#fff000' let endColor = '#ff00ff'</script>
<Color bind:value={startColor} label="Start Color" /><Color bind:value={endColor} label="End Color" />
<div class="demo" style:--a={startColor} style:--b={endColor}></div>
<style> .demo { aspect-ratio: 1; width: 100%; background: linear-gradient(to top, var(--a), var(--b)); }</style>Dynamic Props
This component has dynamic props, which means the available props can change depending on the value or type of other props.
Props contingent on certain conditions are annotated below with a dynamic flag, and include explanations of the “conditions” affecting the prop’s availability. More Info →
disabledSection titled “disabled” | |
| Description | Prevent interactivity and gray out the control. |
|---|---|
| Type | boolean |
| Default | false |
| optional | |
| Description | Custom color scheme. If undefined, inherits default Tweakpane theme equivalent to
|
|---|---|
| Type | Theme |
| Default | undefined |
| optional | |
| Description | Text displayed next to control. |
|---|---|
| Type | string |
| Default | undefined |
| bindablerequired | |
| Description | The value to control. A color value to control. Use either a color-like string (e.g. #ff00ff), a number (e.g.
0xff00ff), an object with The type of this value will determine the availability of the |
|---|---|
| Type | ColorValue |
userExpandableSection titled “userExpandable” | |
| Description | Allow users to interactively expand / contract the picker. |
|---|---|
| Type | boolean |
| Default | true |
expandedSection titled “expanded” | |
| Description | Expand or collapse the input's picker. |
|---|---|
| Type | boolean |
| Default | false |
pickerSection titled “picker” | |
| Description | The style of value "picker" to use in the input. |
|---|---|
| Type | 'inline' | 'popup' |
| Default | 'popup' |
| optionaldynamic | |
| Description | Whether to treat a |
|---|---|
| Type | boolean |
| Default | false |
| Conditions | Available when value is of type number, since string, object, and tuple values carry their own alpha information. |
| optionaldynamic | |
| Description | Whether to treat |
|---|---|
| Type | 'float' | 'int' |
| Default | 'int' |
| Conditions | Available when value is an object or value is a tuple, since string values carry their own type information and number values are always treated as integers. |
Events
Section titled “Events” changeSection titled “change” | |
| Description | Fires when This event is provided for advanced use cases. It's usually preferred to
bind to the The |
|---|---|
| Extends | ValueChangeEvent |
| Type | ColorChangeEvent |