@@ -372,42 +372,43 @@ export class Extension {
372372 const urlInfo = this . getURLInfo ( url ) ;
373373 if ( this . isEnabled ( ) && isURLEnabled ( url , this . user . settings , urlInfo ) ) {
374374 const custom = this . user . settings . customThemes . find ( ( { url : urlList } ) => isURLInList ( url , urlList ) ) ;
375- const filterConfig = custom ? custom . theme : this . user . settings . theme ;
375+ const preset = custom ? null : this . user . settings . presets . find ( ( { urls} ) => isURLInList ( url , urls ) ) ;
376+ const theme = custom ? custom . theme : preset ? preset . theme : this . user . settings . theme ;
376377
377378 console . log ( `Creating CSS for url: ${ url } ` ) ;
378- switch ( filterConfig . engine ) {
379+ switch ( theme . engine ) {
379380 case ThemeEngines . cssFilter : {
380381 return {
381382 type : 'add-css-filter' ,
382- data : createCSSFilterStylesheet ( filterConfig , url , frameURL , this . config . INVERSION_FIXES ) ,
383+ data : createCSSFilterStylesheet ( theme , url , frameURL , this . config . INVERSION_FIXES ) ,
383384 } ;
384385 }
385386 case ThemeEngines . svgFilter : {
386387 if ( isFirefox ( ) ) {
387388 return {
388389 type : 'add-css-filter' ,
389- data : createSVGFilterStylesheet ( filterConfig , url , frameURL , this . config . INVERSION_FIXES ) ,
390+ data : createSVGFilterStylesheet ( theme , url , frameURL , this . config . INVERSION_FIXES ) ,
390391 } ;
391392 }
392393 return {
393394 type : 'add-svg-filter' ,
394395 data : {
395- css : createSVGFilterStylesheet ( filterConfig , url , frameURL , this . config . INVERSION_FIXES ) ,
396- svgMatrix : getSVGFilterMatrixValue ( filterConfig ) ,
396+ css : createSVGFilterStylesheet ( theme , url , frameURL , this . config . INVERSION_FIXES ) ,
397+ svgMatrix : getSVGFilterMatrixValue ( theme ) ,
397398 svgReverseMatrix : getSVGReverseFilterMatrixValue ( ) ,
398399 } ,
399400 } ;
400401 }
401402 case ThemeEngines . staticTheme : {
402403 return {
403404 type : 'add-static-theme' ,
404- data : filterConfig . stylesheet && filterConfig . stylesheet . trim ( ) ?
405- filterConfig . stylesheet :
406- createStaticStylesheet ( filterConfig , url , frameURL , this . config . STATIC_THEMES ) ,
405+ data : theme . stylesheet && theme . stylesheet . trim ( ) ?
406+ theme . stylesheet :
407+ createStaticStylesheet ( theme , url , frameURL , this . config . STATIC_THEMES ) ,
407408 } ;
408409 }
409410 case ThemeEngines . dynamicTheme : {
410- const filter = { ...filterConfig } ;
411+ const filter = { ...theme } ;
411412 delete filter . engine ;
412413 const fixes = getDynamicThemeFixesFor ( url , frameURL , this . config . DYNAMIC_THEME_FIXES , this . user . settings . enableForPDF ) ;
413414 const isIFrame = frameURL != null ;
@@ -417,7 +418,7 @@ export class Extension {
417418 } ;
418419 }
419420 default : {
420- throw new Error ( `Unknown engine ${ filterConfig . engine } ` ) ;
421+ throw new Error ( `Unknown engine ${ theme . engine } ` ) ;
421422 }
422423 }
423424 } else {
0 commit comments