File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "bug_report_endpoint_url" : " https://riot.im/bugreports/submit" ,
88 "enableLabs" : true ,
99 "default_federate" : true ,
10+ "default_theme" : " light" ,
1011 "roomDirectory" : {
1112 "servers" : [
1213 " matrix.org"
Original file line number Diff line number Diff line change 2525 var match = file.match(/^bundles\/.*?\/theme-(.*)\.css$/);
2626 if (match) {
2727 var title = match[1].charAt(0).toUpperCase() + match[1].slice(1);
28- var light = match[1] == 'light';
2928 % >
30- < link rel ="<%= light ? '' : ' alternate ' %> stylesheet " title ="<%= title %> "
29+ < link rel ="alternate stylesheet " title ="<%= title %> "
3130 href ="<%= file %> ">
3231 < % } else { %>
3332 < link rel ="stylesheet " href ="<%= file %> ">
Original file line number Diff line number Diff line change @@ -281,6 +281,23 @@ async function loadApp() {
281281 configError = e ;
282282 }
283283
284+ // as quickly as we possibly can, set a default theme...
285+ const styleElements = Object . create ( null ) ;
286+ let a ;
287+ for ( let i = 0 ; ( a = document . getElementsByTagName ( "link" ) [ i ] ) ; i ++ ) {
288+ const href = a . getAttribute ( "href" ) ;
289+ // shouldn't we be using the 'title' tag rather than the href?
290+ const match = href . match ( / ^ b u n d l e s \/ .* \/ t h e m e - ( .* ) \. c s s $ / ) ;
291+ if ( match ) {
292+ if ( match [ 1 ] === ( configJson . default_theme || 'light' ) ) {
293+ // remove the alternative flag off the stylesheet
294+ a . setAttribute ( "rel" , "stylesheet" ) ;
295+ }
296+ }
297+ }
298+ // XXX: do we also need to call MatrixChat.setTheme here to do any random fixups (e.g. svg tint)
299+
300+
284301 if ( window . localStorage && window . localStorage . getItem ( 'mx_accepts_unsupported_browser' ) ) {
285302 console . log ( 'User has previously accepted risks in using an unsupported browser' ) ;
286303 validBrowser = true ;
You can’t perform that action at this time.
0 commit comments