diff --git a/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.ts b/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.ts index b9cfa747d7..1df93c326c 100644 --- a/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.ts +++ b/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.ts @@ -1,4 +1,5 @@ import { Component, useExternalListener, useState } from "@odoo/owl"; +import { isColorValid } from "../../../helpers"; import { TABLE_STYLES_TEMPLATES, buildTableStyle } from "../../../helpers/table_presets"; import { Color, @@ -31,6 +32,8 @@ css/* scss */ ` } `; +const DEFAULT_TABLE_STYLE_COLOR = "#3C78D8"; + export interface TableStyleEditorPanelProps { onCloseSidePanel: () => void; styleId?: string; @@ -68,7 +71,7 @@ export class TableStyleEditorPanel extends Component< : null; return { pickerOpened: false, - primaryColor: editedStyle?.primaryColor || "#3C78D8", + primaryColor: editedStyle?.primaryColor || DEFAULT_TABLE_STYLE_COLOR, selectedTemplateName: editedStyle?.templateName || "lightColoredText", styleName: editedStyle?.displayName || this.env.model.getters.getNewCustomTableStyleName(), }; @@ -79,7 +82,7 @@ export class TableStyleEditorPanel extends Component< } onColorPicked(color: Color) { - this.state.primaryColor = color; + this.state.primaryColor = isColorValid(color) ? color : DEFAULT_TABLE_STYLE_COLOR; this.state.pickerOpened = false; } diff --git a/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.xml b/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.xml index db3764dc31..17f385453f 100644 --- a/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.xml +++ b/src/components/side_panel/table_style_editor_panel/table_style_editor_panel.xml @@ -9,7 +9,11 @@ Style color
Primary table style color - +