---
title: Color Input Type
product: Form Library
description: Let your respondents answer questions that require specifying a color, either with a visual color picker interface or by entering the color in RGB, HSL, or HEX format. View a free demo for JavaScript.
framework: jQuery
source: https://surveyjs.io/form-library/examples/color-input-question/jquery
index: https://surveyjs.io/form-library/examples/overview.md
---

# Color Input Type (jQuery)

A color input form field is useful when respondents are asked to specify a color. They can enter a color in RGB, HSL, and HEX formats or select it with a visual interface. This demo shows how to add a color input question to a survey in your React, Vue, jQuery, Angular, or Vanilla JavaScript application.

To create a color input form field, configure a regular text entry question first: define an object with the `type` property set to `"text"` and add it to the [`elements`](https://surveyjs.io/form-library/documentation/pagemodel#elements) array. Within this object, specify the question's [`title`](https://surveyjs.io/form-library/documentation/questiontextmodel#title) and a unique [`name`](https://surveyjs.io/form-library/documentation/questiontextmodel#name) that identifies the question. To transform the text entry form field into a color input question, set the [`inputType`](https://surveyjs.io/form-library/documentation/api-reference/questiontextmodel#inputType) property to `"color"`.

## Files

### `public/index.html`

```html
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import $ from "jquery";
import { Model } from "survey-core";
import "survey-js-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";

const survey = new Model(json);
survey.onComplete.add((sender, options) => {
    console.log(JSON.stringify(sender.data, null, 3));
});

$("#surveyElement").Survey({ model: survey });
```

### `src/json.js`

```js
export const json = {
  "elements": [{
    "name": "color",
    "type": "text",
    "title": "Select a color",
    "inputType": "color",
    "defaultValue": "#19b394"
  }]
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

```json
{
  "dependencies": {
    "jquery": "latest",
    "survey-core": "latest",
    "survey-js-ui": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/color-input-question/angular.md)
- [React](https://surveyjs.io/form-library/examples/color-input-question/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/color-input-question/vue3js.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/color-input-question/vanillajs.md)
