@@ -3,7 +3,7 @@ import React from 'react';
3
3
import { AddonPanel , type SyntaxHighlighterFormatTypes } from 'storybook/internal/components' ;
4
4
import { ADDON_ID , PANEL_ID , PARAM_KEY , SNIPPET_RENDERED } from 'storybook/internal/docs-tools' ;
5
5
import { addons , types , useChannel , useParameter } from 'storybook/internal/manager-api' ;
6
- import { ignoreSsrWarning , styled } from 'storybook/internal/theming' ;
6
+ import { ignoreSsrWarning , styled , useTheme } from 'storybook/internal/theming' ;
7
7
8
8
import { Source , type SourceParameters } from '@storybook/blocks' ;
9
9
@@ -30,6 +30,7 @@ addons.register(ADDON_ID, (api) => {
30
30
render : ( { active } ) => {
31
31
const parameter = useParameter ( PARAM_KEY , {
32
32
source : { code : '' } as SourceParameters ,
33
+ theme : 'dark' ,
33
34
} ) ;
34
35
35
36
const [ codeSnippet , setSourceCode ] = React . useState < {
@@ -43,14 +44,17 @@ addons.register(ADDON_ID, (api) => {
43
44
} ,
44
45
} ) ;
45
46
47
+ const theme = useTheme ( ) ;
48
+ const isDark = theme . base !== 'light' ;
49
+
46
50
return (
47
51
< AddonPanel active = { ! ! active } >
48
52
< SourceStyles >
49
53
< Source
50
54
{ ...parameter . source }
51
55
code = { parameter . source . code || codeSnippet . source }
52
56
format = { parameter . source . format || codeSnippet . format }
53
- dark
57
+ dark = { isDark }
54
58
/>
55
59
</ SourceStyles >
56
60
</ AddonPanel >
0 commit comments