File tree Expand file tree Collapse file tree 1 file changed +41
-12
lines changed Expand file tree Collapse file tree 1 file changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,47 @@ if (!domain.value) {
86
86
watch (domain , () => refresh (), { once: true })
87
87
}
88
88
89
+ const favicon = computed (() => {
90
+ const radius = 80
91
+ const stroke = 14
92
+ const normalizedRadius = radius - stroke * 2
93
+ const circumference = normalizedRadius * 2 * Math .PI
94
+
95
+ const value = (results .value ? Math .floor ((results .value .performance + results .value .accessibility + results .value .bestPractices + results .value .seo ) / 4 ) : 97 )
96
+ const color = value >= 90 ? ' #23c55e' : value >= 50 ? ' #fbbf24' : ' #ef4444'
97
+ const svg = ` <svg xmlns="http://www.w3.org/2000/svg" height="${radius * 2 }" width="${radius * 2 }">
98
+ <circle
99
+ stroke="${color }"
100
+ fill="transparent"
101
+ stroke-linecap="round"
102
+ stroke-dasharray="${circumference + ' ' + circumference }"
103
+ style="transform-origin:center;stroke-dashoffset: ${circumference - (Math .floor (value / 4 ) * 4 ) / 100 * circumference };transform: rotate(270deg)"
104
+ stroke-width="${stroke }"
105
+ r="${normalizedRadius }"
106
+ cx="${radius }"
107
+ cy="${radius }"
108
+ />
109
+ <circle
110
+ fill="${color }"
111
+ stroke-width="${stroke }"
112
+ r="${normalizedRadius - 35 }"
113
+ cx="${radius }"
114
+ cy="${radius }"
115
+ />
116
+ </svg> `
117
+ return ` data:image/svg+xml;base64,${btoa (svg )} `
118
+ })
119
+
120
+ useHead ({
121
+ link: [
122
+ {
123
+ rel: ' icon' ,
124
+ type: ' image/svg' ,
125
+ href : () => favicon .value
126
+ }
127
+ ]
128
+ })
129
+
89
130
useServerHead ({
90
131
htmlAttrs: {
91
132
lang: ' en' ,
@@ -100,18 +141,6 @@ useServerHead({
100
141
sizes: ' 180x180' ,
101
142
href: ' /apple-touch-icon.png'
102
143
},
103
- {
104
- rel: ' icon' ,
105
- type: ' image/png' ,
106
- sizes: ' 32x32' ,
107
- href: ' /favicon-32x32.png'
108
- },
109
- {
110
- rel: ' icon' ,
111
- type: ' image/png' ,
112
- sizes: ' 16x16' ,
113
- href: ' /favicon-16x16.png'
114
- },
115
144
{
116
145
rel: ' manifest' ,
117
146
href: ' /site.webmanifest'
You can’t perform that action at this time.
0 commit comments