From f045444fe475bcf8c2fe4c9d39632fd74596214f Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Wed, 26 Oct 2022 11:33:02 +0200 Subject: [PATCH] feat(config): autoApplyContrastColor --- docs/reference/config.md | 12 ++++++++++++ examples/vue3/histoire.config.ts | 1 + examples/vue3/src/components/ContrastColor.story.vue | 5 ++++- .../app/components/story/StoryVariantGridItem.vue | 11 ++++++++--- .../story/StoryVariantSinglePreviewNative.vue | 11 ++++++++--- .../histoire-app/src/app/util/preview-settings.ts | 6 +++++- packages/histoire-shared/src/types/config.ts | 4 ++++ 7 files changed, 42 insertions(+), 8 deletions(-) diff --git a/docs/reference/config.md b/docs/reference/config.md index c71b9e00..aeb2c3b7 100644 --- a/docs/reference/config.md +++ b/docs/reference/config.md @@ -296,6 +296,18 @@ You can use current contrast color via the css variable `--histoire-contrast-col } ``` +## `autoApplyContrastColor` + +`boolean` - Default: `false` + +Automatically apply the contrast color to the story preview text. + +```ts +export default defineConfig({ + autoApplyContrastColor: true, +}) +``` + ## `sandboxDarkClass` `string` - Default: `'dark'` diff --git a/examples/vue3/histoire.config.ts b/examples/vue3/histoire.config.ts index a24d6981..19d374a2 100644 --- a/examples/vue3/histoire.config.ts +++ b/examples/vue3/histoire.config.ts @@ -14,4 +14,5 @@ export default defineConfig({ contrastColor: '#005142', }, ], + // autoApplyContrastColor: true, }) diff --git a/examples/vue3/src/components/ContrastColor.story.vue b/examples/vue3/src/components/ContrastColor.story.vue index 2326eb84..7dd09387 100644 --- a/examples/vue3/src/components/ContrastColor.story.vue +++ b/examples/vue3/src/components/ContrastColor.story.vue @@ -1,6 +1,9 @@ diff --git a/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue b/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue index 35a95acb..d980537a 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue @@ -1,5 +1,5 @@