@@ -69,7 +69,11 @@ export function Root(props: BrightProps) {
6969 ...style ,
7070 } }
7171 >
72- < Style mode = { mode } lineNumbers = { props . lineNumbers } />
72+ < Style
73+ mode = { mode }
74+ lineNumbers = { props . lineNumbers }
75+ lightThemeSelector = { props . lightThemeSelector }
76+ />
7377 { title && < TitleBar { ...props } /> }
7478 < Pre { ...props } />
7579 </ div >
@@ -102,9 +106,11 @@ export function Pre(brightProps: BrightProps) {
102106function Style ( {
103107 mode,
104108 lineNumbers,
109+ lightThemeSelector,
105110} : {
106111 mode : "dark" | "light" | undefined
107112 lineNumbers ?: boolean
113+ lightThemeSelector ?: string
108114} ) {
109115 const lineNumbersStyle = `[data-bright-theme] [data-bright-ln] {
110116 color: var(--line-number-color);
@@ -114,21 +120,27 @@ function Style({
114120 user-select: none;
115121 }`
116122
117- const css = `${ displayStyle ( mode ) }
123+ const css = `${ displayStyle ( mode , lightThemeSelector ) }
118124 [data-bright-theme] ::selection { background-color: var(--selection-background) }
119125 ${ lineNumbers ? lineNumbersStyle : "" }
120126 `
121127 return < style dangerouslySetInnerHTML = { { __html : css } } />
122128}
123129
124- function displayStyle ( mode : "dark" | "light" | undefined ) {
130+ function displayStyle (
131+ mode : "dark" | "light" | undefined ,
132+ lightThemeSelector : string = '[data-theme="light"]'
133+ ) {
125134 if ( ! mode ) return ""
135+
126136 if ( mode === "dark" )
127137 return `[data-bright-mode="dark"] { display: block }
128- [data-theme="light"] [data-bright-mode="dark"] { display: none }`
138+ ${ lightThemeSelector } [data-bright-mode="dark"] { display: none }`
139+
129140 if ( mode === "light" )
130141 return `[data-bright-mode="light"] { display: none }
131- [data-theme="light"] [data-bright-mode="light"] { display: block }`
142+ ${ lightThemeSelector } [data-bright-mode="light"] { display: block }`
143+
132144 return ""
133145}
134146
0 commit comments