@@ -163,27 +163,11 @@ const styles = `
163163 color: var(--text-primary);
164164 margin: 0 8px;
165165 }
166- ` ;
167166
168- function getIconColorVarName ( iconElement ) {
169- const shadowRoot = iconElement . shadowRoot ;
170- if ( ! shadowRoot ) return null ;
171-
172- for ( const sheet of shadowRoot . adoptedStyleSheets || [ ] ) {
173- try {
174- for ( const rule of sheet . cssRules || [ ] ) {
175- if ( rule . style && rule . style . cssText ) {
176- const match = rule . style . cssText . match ( / - - s - i c o n - c o l o r - ( \d + ) / ) ;
177- if ( match ) {
178- return `--s-icon-color-${ match [ 1 ] } ` ;
179- }
180- }
181- }
182- } catch ( e ) { }
167+ html.Mode-Dark .icon {
168+ filter: invert(1);
183169 }
184-
185- return null ;
186- }
170+ ` ;
187171
188172const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
189173const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
@@ -236,31 +220,6 @@ useEffect(() => {
236220 return ( ) => window . removeEventListener ( 'resize' , handleResize ) ;
237221} , [ isMobile ] ) ;
238222
239- useEffect ( ( ) => {
240- const applyIconColors = ( ) => {
241- const isDark = document . documentElement . classList . contains ( 'Mode-Dark' ) ;
242- const icons = document . querySelectorAll ( 's-icon' ) ;
243-
244- icons . forEach ( ( icon ) => {
245- const varName = getIconColorVarName ( icon ) ;
246- if ( varName ) {
247- icon . style . setProperty ( varName , isDark ? 'white' : '' ) ;
248- }
249- } ) ;
250- } ;
251-
252- // Apply on mount and when icons/theme change
253- applyIconColors ( ) ;
254-
255- // Watch for theme changes
256- const themeObserver = new MutationObserver ( applyIconColors ) ;
257- themeObserver . observe ( document . documentElement , { attributes : true , attributeFilter : [ 'class' ] } ) ;
258-
259- return ( ) => {
260- themeObserver . disconnect ( ) ;
261- } ;
262- } , [ ] ) ;
263-
264223return (
265224 < >
266225 < style > { styles } </ style >
0 commit comments