File tree 5 files changed +35
-5
lines changed
5 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,13 @@ const App: React.FC = () => {
77
77
const biconomyApiKey = urlParams . get ( "biconomyApiKey" ) || "" ;
78
78
const biconomyApiId = urlParams . get ( "biconomyApiId" ) || "" ;
79
79
80
- const colorScheme = urlParams . get ( "theme" ) === "dark" ? "dark" : "light" ;
80
+ let _theme = urlParams . get ( "theme" ) ;
81
+ if ( _theme === "system" ) {
82
+ _theme = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
83
+ ? "dark"
84
+ : "light" ;
85
+ }
86
+ const colorScheme = _theme === "dark" ? "dark" : "light" ;
81
87
const primaryColor = urlParams . get ( "primaryColor" ) || "purple" ;
82
88
83
89
const sdkOptions = useGasless ( relayerUrl , biconomyApiKey , biconomyApiId ) ;
Original file line number Diff line number Diff line change @@ -71,7 +71,13 @@ const App: React.FC = () => {
71
71
const biconomyApiKey = urlParams . get ( "biconomyApiKey" ) || "" ;
72
72
const biconomyApiId = urlParams . get ( "biconomyApiId" ) || "" ;
73
73
74
- const colorScheme = urlParams . get ( "theme" ) === "dark" ? "dark" : "light" ;
74
+ let _theme = urlParams . get ( "theme" ) ;
75
+ if ( _theme === "system" ) {
76
+ _theme = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
77
+ ? "dark"
78
+ : "light" ;
79
+ }
80
+ const colorScheme = _theme === "dark" ? "dark" : "light" ;
75
81
const primaryColor = urlParams . get ( "primaryColor" ) || "purple" ;
76
82
77
83
const sdkOptions = useGasless ( relayerUrl , biconomyApiKey , biconomyApiId ) ;
Original file line number Diff line number Diff line change @@ -72,7 +72,13 @@ const App: React.FC = () => {
72
72
const biconomyApiKey = urlParams . get ( "biconomyApiKey" ) || "" ;
73
73
const biconomyApiId = urlParams . get ( "biconomyApiId" ) || "" ;
74
74
75
- const colorScheme = urlParams . get ( "theme" ) === "dark" ? "dark" : "light" ;
75
+ let _theme = urlParams . get ( "theme" ) ;
76
+ if ( _theme === "system" ) {
77
+ _theme = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
78
+ ? "dark"
79
+ : "light" ;
80
+ }
81
+ const colorScheme = _theme === "dark" ? "dark" : "light" ;
76
82
const primaryColor = urlParams . get ( "primaryColor" ) || "purple" ;
77
83
78
84
const sdkOptions = useGasless ( relayerUrl , biconomyApiKey , biconomyApiId ) ;
Original file line number Diff line number Diff line change @@ -686,7 +686,13 @@ const App: React.FC = () => {
686
686
const relayerUrl = urlParams . get ( "relayUrl" ) || "" ;
687
687
const biconomyApiKey = urlParams . get ( "biconomyApiKey" ) || "" ;
688
688
const biconomyApiId = urlParams . get ( "biconomyApiId" ) || "" ;
689
- const colorScheme = urlParams . get ( "theme" ) === "dark" ? "dark" : "light" ;
689
+ let _theme = urlParams . get ( "theme" ) ;
690
+ if ( _theme === "system" ) {
691
+ _theme = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
692
+ ? "dark"
693
+ : "light" ;
694
+ }
695
+ const colorScheme = _theme === "dark" ? "dark" : "light" ;
690
696
const primaryColor = urlParams . get ( "primaryColor" ) || "purple" ;
691
697
const secondaryColor = urlParams . get ( "secondaryColor" ) || "orange" ;
692
698
Original file line number Diff line number Diff line change @@ -660,7 +660,13 @@ const App: React.FC = () => {
660
660
const relayerUrl = urlParams . get ( "relayUrl" ) || "" ;
661
661
const biconomyApiKey = urlParams . get ( "biconomyApiKey" ) || "" ;
662
662
const biconomyApiId = urlParams . get ( "biconomyApiId" ) || "" ;
663
- const colorScheme = urlParams . get ( "theme" ) === "dark" ? "dark" : "light" ;
663
+ let _theme = urlParams . get ( "theme" ) ;
664
+ if ( _theme === "system" ) {
665
+ _theme = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
666
+ ? "dark"
667
+ : "light" ;
668
+ }
669
+ const colorScheme = _theme === "dark" ? "dark" : "light" ;
664
670
const primaryColor = urlParams . get ( "primaryColor" ) || "purple" ;
665
671
const secondaryColor = urlParams . get ( "secondaryColor" ) || "orange" ;
666
672
You can’t perform that action at this time.
0 commit comments