| @@ -1905,13 +1905,9 @@ | ||
| 1905 | 1905 | [ |
| 1906 | 1906 | 'label' => __('Inherit from the active theme', 'fluent-cart'), |
| 1907 | 1907 | 'value' => ColorPalette::SOURCE_THEME, |
| 1908 | 1908 | 'icon' => 'PaintLine', |
| 1909 | - 'note' => sprintf( | |
| 1910 | - '%1$s %2$s', | |
| 1911 | - __('The storefront palette is rebuilt from your theme, and follows it when the theme changes.', 'fluent-cart'), | |
| 1912 | - ThemePalette::sourceLabel() | |
| 1913 | - ), | |
| 1909 | + 'note' => __('FluentCart uses your active theme\'s colors for the storefront. If they don\'t come through as expected, choose Customize to set them yourself.', 'fluent-cart'), | |
| 1914 | 1910 | ], |
| 1915 | 1911 | [ |
| 1916 | 1912 | 'label' => __('Customize', 'fluent-cart'), |
| 1917 | 1913 | 'value' => ColorPalette::SOURCE_CUSTOM, |
| @@ -2050,10 +2046,13 @@ | ||
| 2050 | 2046 | if (!ThemePalette::hasUsableSource()) { |
| 2051 | 2047 | return __('The active theme publishes nothing to inherit, so the storefront keeps FluentCart\'s own colors.', 'fluent-cart'); |
| 2052 | 2048 | } |
| 2053 | 2049 | |
| 2050 | + // Only a colour with no hex anywhere is unpreviewable. A live | |
| 2051 | + // reference with a hex fallback — what the theme-settings readers and | |
| 2052 | + // Blocksy write — previews as that fallback. | |
| 2054 | 2053 | foreach (ThemePalette::resolve() as $value) { |
| 2055 | - if (!sanitize_hex_color((string)$value)) { | |
| 2054 | + if ((string)$value !== '' && ThemePalette::measurable((string)$value) === '') { | |
| 2056 | 2055 | return __('This theme publishes its palette as CSS variables. The storefront reads them, but they cannot be resolved here — the preview shows FluentCart\'s colors in their place.', 'fluent-cart'); |
| 2057 | 2056 | } |
| 2058 | 2057 | } |
| 2059 | 2058 | |
| @@ -2079,13 +2078,15 @@ | ||
| 2079 | 2078 | |
| 2080 | 2079 | $roles = []; |
| 2081 | 2080 | |
| 2082 | 2081 | foreach (ThemePalette::resolve() as $role => $value) { |
| 2083 | - // A theme that publishes `var(--x)` is written to the storefront | |
| 2084 | - // verbatim and resolved by the browser there, but that property is | |
| 2085 | - // not declared in wp-admin. Unpreviewable, so leave it out and let | |
| 2086 | - // the slot fall back to its own default. | |
| 2087 | - $hex = sanitize_hex_color((string)$value); | |
| 2082 | + // A theme that publishes a bare `var(--x)` is written to the | |
| 2083 | + // storefront verbatim and resolved by the browser there, but that | |
| 2084 | + // property is not declared in wp-admin. Unpreviewable, so leave it | |
| 2085 | + // out and let the slot fall back to its own default. A reference | |
| 2086 | + // with a hex fallback (`var(--x, #hex)`) previews as that hex — | |
| 2087 | + // the same colour the storefront measures it by. | |
| 2088 | + $hex = ThemePalette::measurable((string)$value); | |
| 2088 | 2089 | |
| 2089 | 2090 | if ($hex) { |
| 2090 | 2091 | $roles[$role] = $hex; |
| 2091 | 2092 | } |