@@ -70,13 +70,25 @@ function getBreadcrumbs(html, pathname) {
70
70
return breadcrumbs ;
71
71
}
72
72
73
+ function getThemeColor ( html ) {
74
+ const themeColorRegex = / - - t h e m e - c o l o r : ( # [ 0 - 9 a - f A - F ] { 6 } ) ; / g;
75
+ const themeColorMatch = themeColorRegex . exec ( html ) ;
76
+
77
+ return themeColorMatch [ 1 ] ;
78
+ }
79
+
73
80
const preprocessMetadata = { } ;
74
81
75
82
function createMetadata ( main , document , pathname , html ) {
76
83
const meta = preprocessMetadata ;
77
84
78
85
const urlInfo = urls . find ( ( { URL : url } ) => ( new URL ( url ) . pathname ) === pathname ) ;
79
86
meta . Theme = urlInfo . Theme ;
87
+ const themeColor = getThemeColor ( html ) ;
88
+ report . themeColor = themeColor ;
89
+ if ( themeColor !== '' ) {
90
+ meta . ThemeColor = themeColor ;
91
+ }
80
92
theme = meta . Theme ;
81
93
82
94
meta . Title = document . querySelector ( 'meta[property="og:title"]' ) . content ;
@@ -853,9 +865,7 @@ function findIcon(iconNode) {
853
865
}
854
866
855
867
function inlineIcons ( main , html ) {
856
- const themeColorRegex = / - - t h e m e - c o l o r : ( # [ 0 - 9 a - f A - F ] { 6 } ) ; / g;
857
- const themeColorMatch = themeColorRegex . exec ( html ) ;
858
- const themeColor = themeColorMatch [ 1 ] ;
868
+ const themeColor = getThemeColor ( html ) ;
859
869
860
870
const foundIcons = [ ] ;
861
871
const notFoundIcons = [ ] ;
0 commit comments