From 37eca6af9196f84a7ad090fcc9255c1bca061697 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 1 Jul 2021 00:48:05 +0100 Subject: [PATCH] Only override color style on paragraphs if a color setting exists --- packages/standard-components/src/Text.svelte | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/standard-components/src/Text.svelte b/packages/standard-components/src/Text.svelte index 2e3b2954fc..cc962b572b 100644 --- a/packages/standard-components/src/Text.svelte +++ b/packages/standard-components/src/Text.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, + }, + } }