color
The color widget turns a plain char field into a native color swatch storing #RRGGBB. Its one option, autosave, is already on in list and kanban views, and Odoo 20 removes it.
| Technical name | color |
|---|---|
| Field types | char |
| Views | form, list, kanban |
| Module | web, present in every Odoo database |
| Used in core | 25 occurrences across 9 modules, including marketing_card, website_sale, im_livechat, product, mail, web |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No documented Studio path; the widget is set on a Text field in view XML |
| Alternatives | color_picker, kanban_color_picker, char |
What the Color field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
autosave | boolean | When active, the record is saved immediately on picker commit. Unset, the source enables it for list and kanban view types only; an explicit value wins everywhere. Declared nowhere; read only in extractProps. Removed on the Odoo 20 development branch.(default: true in list and kanban views, false in forms) |
The autosave default is per view type, not global. The source enables it when the view is a list or a kanban and disables it on forms, unless you set the option explicitly, in which case your value wins everywhere. An explicit autosave: false on a list view is how you restore the classic edit-then-save behavior for inline color edits.
Working examples
Commit timing, the empty checker, and what is not validated
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. The development branch removes the autosave option and its view-type defaults; see below. |
| Odoo 19.0 | Verified | Verified against the shipped source, component and template. |
| Odoo 18.0 | Verified | Identical autosave logic and registration, verified in the 18.0 source. |
| Odoo 17.0 | Verified | Widget present with the same registry name. Not re-verified line by line for this page. |
| Odoo 16.0 | Verified | Widget present with the same registry name. Not re-verified line by line for this page. |
Upgrade note. Views from 16 through 19 carry unchanged, including explicit autosave options. Going to Odoo 20, expect explicit autosave keys to become inert rather than breaking: the development branch drops the prop, and unknown options are ignored by convention. Clean them out during the next migration pass anyway.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Color changes in a list save without asking | autosave defaults to true in list and kanban views. Set options="{'autosave': False}" to restore edit-then-save. |
| On a form the color does not stick until Save | autosave defaults to false on forms; the widget follows the normal record flow. Expected. Set autosave: True if the form should commit instantly. |
| Swatch shows a checkerboard | The field is empty; the template shows a transparent pattern instead of black. Pick a color or set a default on the field. |
| Imported values do not display | The widget validates nothing; malformed values, missing #, names like red, paint nothing reliably. Normalize to #RRGGBB on import and add a model constraint. |
| Picker does not open for some users | The field is readonly for them; the input is disabled while the swatch stays visible. Check field-level and view-level readonly rules. |
| Instant saving stopped after moving to the Odoo 20 branch | The development branch removed the autosave option and its defaults. Expected direction for 20; re-check after the final release. |
Color field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
color | Exact colors as data: branding, themes, anything leaving the backend | Native hex input on a char field, with view-dependent instant saving in 19 |
color_picker | Odoo's standard palette on form and list views | Writes a 0 to 11 palette index, not a hex value |
| kanban_color_picker | Coloring kanban cards from the card menu | Same palette index model, kanban card menu placement, instant save |
char | Entering a hex code as plain text | No swatch and no picker, but values are visible as text and copy-paste cleanly |
Frequently asked questions
What does the color widget do in Odoo?+
Which field type does the color widget need?+
Why did my color change save without pressing Save?+
Can users type a hex code directly?+
Does the color widget validate what is stored?+
What changes for the color widget in Odoo 20?+
Brand colors that survive contact with Odoo?
Hex fields feeding websites, documents and portals need validation, sensible defaults and the right save behavior per view. We wire up exactly this kind of front-to-back consistency in Odoo 16 through 19 implementations.
Book a free consultation