Skip to main content
iVentureTeam

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.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 11, 2026Updated August 11, 20266 min read
Odoo 19 form showing a char field rendered by the color widget as a clickable color swatch with the browser's native color picker open.
Technical namecolor
Field typeschar
Viewsform, list, kanban
Moduleweb, present in every Odoo database
Used in core25 occurrences across 9 modules, including marketing_card, website_sale, im_livechat, product, mail, web
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupNo documented Studio path; the widget is set on a Text field in view XML
Alternativescolor_picker, kanban_color_picker, char

What the Color field does

Odoo has two families of color widgets. The palette pickers, color_picker and kanban_color_picker, write an index into Odoo's fixed twelve-entry palette. This widget is the other family: a real color value, any of sixteen million, stored as a hex string in a plain char field.

The implementation, read from the Odoo 19 source, is refreshingly small: a div painted with the current value, with the browser's native <input type="color"> stretched invisibly across it. Clicking the swatch opens the operating system's own color picker, eyedropper and all where the platform provides one. When the field is empty, the swatch shows a transparent checker pattern instead of defaulting to black.

Core uses it where the exact color is the point: livechat button colors, website ribbon backgrounds, marketing card themes, product document tags.

What this means for your team

This is the brand-consistency widget. Palette indexes are fine for internal kanban cards, but the moment a color leaves the backend, a chat bubble on your website, an event badge, a themed customer document, it must be your exact brand hex, not "Odoo purple, slot 5". Storing #1B4D3E in a char field is what makes that exact.

The operational detail to brief your team on is the save behavior. In list and kanban views the widget saves the record by itself the moment the picker closes, which is convenient for bulk-editing theme colors but means there is no discard step: the old value is gone. On forms it participates in the normal edit-then-save flow. Both behaviors come from one option you can override either way.

Supported options in Odoo 19

Verified against color_field.js in the Odoo 19.0 web module. The widget declares no supportedOptions block; the single option below lives only in extractProps, undocumented, with a default that depends on the view type.

OptionTypeWhat it does
autosavebooleanWhen 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

Standard usage on a char field

<field name="brand_color" widget="color"/>

The model side is just a char field:

brand_color = fields.Char(string="Brand Color", default="#875A7B")

List view without instant saving

<field name="brand_color"
       widget="color"
       options="{'autosave': False}"/>

Overrides the list-view default, so edited colors wait for the row's normal save.

Instant saving on a form

<field name="button_color"
       widget="color"
       options="{'autosave': True}"/>

The opposite override: the record saves as soon as the picker commits, useful for settings-style forms.

Commit timing, the empty checker, and what is not validated

A few details from the component and template are worth having on record.

The commit moment is the input's change event. While the native picker is open, the swatch previews the color live, but the record update fires on change, which browsers emit when the picker is closed or the choice confirmed. With autosave on, that is also the save moment.

Empty means transparent, not black. The template paints the swatch with the stored value or, when empty, a transparent checker image. A native color input alone would display black for an empty value, which misleads users into thinking a color was chosen; the checker is the deliberate fix.

Readonly keeps the color visible. The input gets disabled and the container a disabled cursor, but the swatch still shows the value, so readonly lists remain scannable.

Validation is your job. The field is a plain char and the widget only ever writes what the native input produces, a 7-character hex string. Values arriving from imports or the API are not validated by the widget, so a malformed value simply paints nothing. Add a model constraint if the field feeds CSS.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. The development branch removes the autosave option and its view-type defaults; see below.
Odoo 19.0VerifiedVerified against the shipped source, component and template.
Odoo 18.0VerifiedIdentical autosave logic and registration, verified in the 18.0 source.
Odoo 17.0VerifiedWidget present with the same registry name. Not re-verified line by line for this page.
Odoo 16.0VerifiedWidget 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

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. What follows is read from the widget's file on the public development branch, which remains unstable until feature freeze; we re-verify after release.

The autosave option is removed. The development version deletes the option, the prop and the view-type default logic; the update call always follows the standard record flow. In practice list and kanban edits stop saving instantly on their own and behave like every other inline-edited field, a small but real workflow change for teams used to instant color commits in list views. The component also migrates to the new Owl props syntax, which affects JavaScript patches only.

Common problems and fixes

SymptomCause and fix
Color changes in a list save without askingautosave 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 Saveautosave 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 checkerboardThe 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 displayThe 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 usersThe 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 branchThe development branch removed the autosave option and its defaults. Expected direction for 20; re-check after the final release.

Color field vs the alternatives

WidgetBest forKey difference
colorExact colors as data: branding, themes, anything leaving the backendNative hex input on a char field, with view-dependent instant saving in 19
color_pickerOdoo's standard palette on form and list viewsWrites a 0 to 11 palette index, not a hex value
kanban_color_pickerColoring kanban cards from the card menuSame palette index model, kanban card menu placement, instant save
charEntering a hex code as plain textNo swatch and no picker, but values are visible as text and copy-paste cleanly

The test: if the color must match a brand book or feed CSS, store hex with this widget. If it only groups records visually inside Odoo, use the palette pickers, whose twelve indexes come with consistent styling for free.

Frequently asked questions

What does the color widget do in Odoo?+
It renders a char field as a color swatch backed by the browser's native color input. Clicking it opens the system color picker and the chosen value is stored as a hex string such as #875A7B. It is meant for colors that are real data, unlike the palette-index pickers.
Which field type does the color widget need?+
A plain char field; that is the widget's only declared supported type. No selection, no integer, and no special model setup. A default like #875A7B in the field definition gives new records a sensible starting color.
Why did my color change save without pressing Save?+
In list and kanban views the widget's autosave option defaults to on, so the record saves the moment the picker commits. Set options="{'autosave': False}" on the field to restore the normal flow. On forms the default is already off.
Can users type a hex code directly?+
Not into this widget; it only exposes the native picker, though most operating system pickers include a hex input inside them. If typing and pasting hex codes matters, render the same char field with the plain char widget instead, or alongside.
Does the color widget validate what is stored?+
No. Through the UI you always get a well-formed 7-character hex value because the native input produces one, but imports and API writes bypass that, and the widget will not complain. Add a Python constraint if downstream CSS or reports depend on valid values.
What changes for the color widget in Odoo 20?+
The development branch removes the autosave option entirely, so instant list-view saving disappears and the widget always follows the standard record flow. Odoo 20 is expected in late September 2026; treat this as direction until release, which is when we re-verify this page.

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

How this page was produced

Behavior on this page was read from the Odoo 19.0 web module source, color_field.js and its template, which is where the autosave defaulting, the change-event commit and the transparent checker are visible. The 18.0 source was compared for the version table, and the Odoo 20 statement comes from diffing against the public development branch, where the option's removal is visible. Spotted an error? Tell us and we will correct the page.