From ab2331a2910cffb7e3e98f2283fcca7b47c8d8be Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 1 Jul 2021 00:47:38 +0100 Subject: [PATCH] Only override existing color style if a color setting exists for Headings --- .../standard-components/src/Heading.svelte | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/standard-components/src/Heading.svelte b/packages/standard-components/src/Heading.svelte index 7cb7ed79d8..96df7ce407 100644 --- a/packages/standard-components/src/Heading.svelte +++ b/packages/standard-components/src/Heading.svelte @@ -19,12 +19,19 @@ // Add color styles to main styles object, otherwise the styleable helper // overrides the color when it's passed as inline style. - $: styles = { - ...$component.styles, - normal: { - ...$component.styles?.normal, - color, - }, + $: styles = enrichStyles($component.styles, color) + + const enrichStyles = (styles, color) => { + if (!color) { + return styles + } + return { + ...styles, + normal: { + ...styles?.normal, + color, + }, + } }