File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @gitbook/integration-front ' : minor
3+ ---
4+
5+ Force-support light/dark mode in the front widget
Original file line number Diff line number Diff line change 55 s = d . createElement ( 'script' ) ;
66 s . src = 'https://chat-assets.frontapp.com/v1/chat.bundle.js' ;
77 s . async = 1 ;
8- d . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( s ) ;
98
109 s . onload = function ( ) {
1110 if ( window . FrontChat ) {
1211 window . FrontChat ( 'init' , { chatId : chatId , useDefaultLauncher : true } ) ;
1312 }
13+
14+ // Workaround for Front's color-scheme bug
15+ // Front's widget uses color-scheme: normal which doesn't respect page color schemes
16+ // This override allows proper light/dark mode support
17+ const styleOverride = d . createElement ( 'style' ) ;
18+ styleOverride . textContent = `
19+ [data-front-chat-container],
20+ [data-front-chat-container] iframe,
21+ #front-chat-container,
22+ #front-chat-container iframe {
23+ color-scheme: light dark !important;
24+ }
25+ ` ;
26+ d . head . appendChild ( styleOverride ) ;
1427 } ;
1528
16- d . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( s ) ;
29+ // Append to body (just before closing </body> tag) as per Front's documentation
30+ d . getElementsByTagName ( 'body' ) [ 0 ] . appendChild ( s ) ;
1731} ) ( window , document ) ;
You can’t perform that action at this time.
0 commit comments