fix(logo): favicon and logo colour consistency (#2822)
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 987 B |
@@ -6,17 +6,17 @@
|
||||
<div class="setup-header">
|
||||
<div class="logo-wrapper">
|
||||
<svg class="logo-icon" viewBox="0 0 100 126" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M25.8062 106.614V113.077V119.537V126L32.2559 119.537L38.7093 126V119.537V113.077V106.614H25.8062Z" fill="white"/>
|
||||
<path d="M25.8062 106.614V113.077V119.537V126L32.2559 119.537L38.7093 126V119.537V113.077V106.614H25.8062Z" fill="var(--color-logo-bookmark)"/>
|
||||
<path d="M38.7093 29.0758H96.7715C98.5535 29.0758 99.9964 27.6307 99.9964 25.846V3.22984C99.9964 1.44512 98.5535 0 96.7715 0H12.9031C10.5512 0 8.35077 0.63224 6.44975 1.73414C4.49102 2.86856 2.86054 4.50155 1.72787 6.4633C0.631268 8.36363 0 10.5674 0 12.923V106.614C0 113.753 5.7752 119.537 12.9031 119.537H21.1529V113.077H12.9031C9.33915 113.077 6.44975 110.183 6.44975 106.614C6.44975 103.044 9.33915 100.15 12.9031 100.15H93.5466C97.1106 100.15 100 97.2566 100 93.6871V41.9988C100 38.4293 97.1106 35.5355 93.5466 35.5355H38.7093C36.9273 35.5355 35.4845 36.9806 35.4845 38.7653V61.3815C35.4845 63.1662 36.9273 64.6113 38.7093 64.6113H67.7404C69.5224 64.6113 70.9653 66.0564 70.9653 67.8412C70.9653 69.6259 69.5224 71.071 67.7404 71.071H38.7093C33.3634 71.071 29.0311 66.732 29.0311 61.3779V38.7617C29.0311 33.4076 33.3634 29.0686 38.7093 29.0686V29.0758Z" fill="url(#setup-logo-gradient)"/>
|
||||
<path d="M96.7715 113.077H43.5539V119.537H96.7715C98.5535 119.537 99.9964 118.092 99.9964 116.307C99.9964 114.522 98.5535 113.077 96.7715 113.077Z" fill="url(#setup-logo-gradient-secondary)"/>
|
||||
<defs>
|
||||
<linearGradient id="setup-logo-gradient" x1="50" y1="0" x2="50" y2="119.537" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" style="stop-color: var(--p-primary-300)"/>
|
||||
<stop offset="1" style="stop-color: var(--p-primary-500)"/>
|
||||
<stop offset="0" style="stop-color: var(--color-logo-start)"/>
|
||||
<stop offset="1" style="stop-color: var(--color-logo-end)"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="setup-logo-gradient-secondary" x1="50" y1="0" x2="50" y2="119.537" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" style="stop-color: var(--p-primary-300)"/>
|
||||
<stop offset="1" style="stop-color: var(--p-primary-500)"/>
|
||||
<stop offset="0" style="stop-color: var(--color-logo-start)"/>
|
||||
<stop offset="1" style="stop-color: var(--color-logo-end)"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
@@ -3,7 +3,7 @@ import {describe, expect, it, vi} from 'vitest';
|
||||
import {FaviconService} from './favicon-service';
|
||||
|
||||
describe('FaviconService', () => {
|
||||
it('updates an existing favicon link with a generated SVG URL', () => {
|
||||
it('updates the SVG favicon link with a generated SVG URL', async () => {
|
||||
const favicon = {type: '', href: ''} as HTMLLinkElement;
|
||||
const querySelectorSpy = vi.spyOn(document, 'querySelector').mockReturnValue(favicon);
|
||||
const createObjectUrlSpy = vi.spyOn(URL, 'createObjectURL').mockReturnValue('blob:favicon');
|
||||
@@ -11,8 +11,12 @@ describe('FaviconService', () => {
|
||||
const service = new FaviconService();
|
||||
service.updateFavicon('#abcdef', '#123456');
|
||||
|
||||
expect(querySelectorSpy).toHaveBeenCalledWith("link[rel*='icon']");
|
||||
expect(querySelectorSpy).toHaveBeenCalledWith("link[rel~='icon'][type='image/svg+xml']");
|
||||
expect(createObjectUrlSpy).toHaveBeenCalledOnce();
|
||||
const svg = await (createObjectUrlSpy.mock.calls[0][0] as Blob).text();
|
||||
expect(svg).toContain('stop-color="#abcdef"');
|
||||
expect(svg).toContain('stop-color="#123456"');
|
||||
expect(svg).toContain('fill="#FF2126"');
|
||||
expect(favicon.type).toBe('image/svg+xml');
|
||||
expect(favicon.href).toBe('blob:favicon');
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ export class FaviconService {
|
||||
|
||||
private svgTemplate = (startColor: string, endColor: string) => `
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 119 150" fill="none">
|
||||
<path d="M30.7094 126.921V134.616V142.306V150L38.3846 142.306L46.064 150V142.306V134.616V126.921H30.7094Z" fill="white"/>
|
||||
<path d="M30.7094 126.921V134.616V142.306V150L38.3846 142.306L46.064 150V142.306V134.616V126.921H30.7094Z" fill="#FF2126"/>
|
||||
<path d="M46.0641 34.6141H115.158C117.279 34.6141 118.996 32.8937 118.996 30.769V3.84505C118.996 1.72038 117.279 0 115.158 0H15.3547C12.5559 0 9.93741 0.752667 7.6752 2.06446C5.34431 3.41496 3.40405 5.35899 2.05616 7.6944C0.751208 9.9567 0 12.5803 0 15.3845V126.921C0 135.42 6.87248 142.306 15.3547 142.306H25.1719V134.615H15.3547C11.1136 134.615 7.6752 131.17 7.6752 126.921C7.6752 122.672 11.1136 119.227 15.3547 119.227H111.32C115.562 119.227 119 115.782 119 111.532V49.9986C119 45.7492 115.562 42.3042 111.32 42.3042H46.0641C43.9435 42.3042 42.2265 44.0245 42.2265 46.1492V73.0732C42.2265 75.1978 43.9435 76.9182 46.0641 76.9182H80.6111C82.7317 76.9182 84.4487 78.6386 84.4487 80.7633C84.4487 82.8879 82.7317 84.6083 80.6111 84.6083H46.0641C39.7024 84.6083 34.547 79.4429 34.547 73.0689V46.1449C34.547 39.7709 39.7024 34.6055 46.0641 34.6055V34.6141Z" fill="url(#favicon-gradient)"/>
|
||||
<path d="M115.158 134.615H51.8291V142.306H115.158C117.279 142.306 118.996 140.585 118.996 138.461C118.996 136.336 117.279 134.615 115.158 134.615Z" fill="url(#favicon-gradient)"/>
|
||||
<defs>
|
||||
@@ -27,7 +27,7 @@ export class FaviconService {
|
||||
URL.revokeObjectURL(this.currentUrl);
|
||||
}
|
||||
|
||||
let favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement;
|
||||
let favicon = document.querySelector("link[rel~='icon'][type='image/svg+xml']") as HTMLLinkElement;
|
||||
if (!favicon) {
|
||||
favicon = document.createElement('link');
|
||||
favicon.rel = 'icon';
|
||||
|
||||
@@ -29,6 +29,8 @@ function createThemeComputedStyle(): CSSStyleDeclaration {
|
||||
['0', '50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950'].forEach((stop) => {
|
||||
values.set(`--color-surface-${stop}`, `surface-${stop}`);
|
||||
});
|
||||
values.set('--color-logo-start', 'logo-start');
|
||||
values.set('--color-logo-end', 'logo-end');
|
||||
|
||||
return {
|
||||
getPropertyValue: (propertyName: string) => values.get(propertyName) ?? '',
|
||||
@@ -106,8 +108,8 @@ describe('AppThemeService', () => {
|
||||
expect(rootStyle.getPropertyValue('--color-app')).toBe('');
|
||||
expect(rootStyle.getPropertyValue('--color-card')).toBe('');
|
||||
expect(faviconServiceMock.updateFavicon).toHaveBeenCalledWith(
|
||||
'primary-300',
|
||||
'primary-500'
|
||||
'logo-start',
|
||||
'logo-end'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -122,8 +124,8 @@ describe('AppThemeService', () => {
|
||||
expect(rootStyle.getPropertyValue('--primary-300')).toBe('');
|
||||
expect(rootStyle.getPropertyValue('--color-card')).toBe('');
|
||||
expect(faviconServiceMock.updateFavicon).toHaveBeenLastCalledWith(
|
||||
'primary-300',
|
||||
'primary-500'
|
||||
'logo-start',
|
||||
'logo-end'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -267,8 +267,8 @@ export class AppThemeService {
|
||||
private updateFavicon(): void {
|
||||
const styles = getComputedStyle(this.document.documentElement);
|
||||
this.faviconService.updateFavicon(
|
||||
styles.getPropertyValue('--color-primary-300').trim(),
|
||||
styles.getPropertyValue('--color-primary-500').trim(),
|
||||
styles.getPropertyValue('--color-logo-start').trim(),
|
||||
styles.getPropertyValue('--color-logo-end').trim(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
<svg viewBox="0 0 119 150" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M30.7094 126.921V134.616V142.306V150L38.3846 142.306L46.064 150V142.306V134.616V126.921H30.7094Z" fill="white"/>
|
||||
<path d="M46.0641 34.6141H115.158C117.279 34.6141 118.996 32.8937 118.996 30.769V3.84505C118.996 1.72038 117.279 0 115.158 0H15.3547C12.5559 0 9.93741 0.752667 7.6752 2.06446C5.34431 3.41496 3.40405 5.35899 2.05616 7.6944C0.751208 9.9567 0 12.5803 0 15.3845V126.921C0 135.42 6.87248 142.306 15.3547 142.306H25.1719V134.615H15.3547C11.1136 134.615 7.6752 131.17 7.6752 126.921C7.6752 122.672 11.1136 119.227 15.3547 119.227H111.32C115.562 119.227 119 115.782 119 111.532V49.9986C119 45.7492 115.562 42.3042 111.32 42.3042H46.0641C43.9435 42.3042 42.2265 44.0245 42.2265 46.1492V73.0732C42.2265 75.1978 43.9435 76.9182 46.0641 76.9182H80.6111C82.7317 76.9182 84.4487 78.6386 84.4487 80.7633C84.4487 82.8879 82.7317 84.6083 80.6111 84.6083H46.0641C39.7024 84.6083 34.547 79.4429 34.547 73.0689V46.1449C34.547 39.7709 39.7024 34.6055 46.0641 34.6055V34.6141Z" fill="url(#paint0_linear_2_61)"/>
|
||||
<path d="M115.158 134.615H51.8291V142.306H115.158C117.279 142.306 118.996 140.585 118.996 138.461C118.996 136.336 117.279 134.615 115.158 134.615Z" fill="url(#paint1_linear_2_61)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_2_61" x1="59.5" y1="0" x2="59.5" y2="142.306" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0%" style="stop-color: var(--primary-300, #fdba74)"/>
|
||||
<stop offset="100%" style="stop-color: var(--primary-500, #f97316)"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_2_61" x1="59.5" y1="0" x2="59.5" y2="142.306" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0%" style="stop-color: var(--primary-300, #fdba74)"/>
|
||||
<stop offset="100%" style="stop-color: var(--primary-500, #f97316)"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 119 150" fill="none">
|
||||
<path d="M30.7094 126.921V134.616V142.306V150L38.3846 142.306L46.064 150V142.306V134.616V126.921H30.7094Z" fill="#FF2126"/>
|
||||
<path d="M46.0641 34.6141H115.158C117.279 34.6141 118.996 32.8937 118.996 30.769V3.84505C118.996 1.72038 117.279 0 115.158 0H15.3547C12.5559 0 9.93741 0.752667 7.6752 2.06446C5.34431 3.41496 3.40405 5.35899 2.05616 7.6944C0.751208 9.9567 0 12.5803 0 15.3845V126.921C0 135.42 6.87248 142.306 15.3547 142.306H25.1719V134.615H15.3547C11.1136 134.615 7.6752 131.17 7.6752 126.921C7.6752 122.672 11.1136 119.227 15.3547 119.227H111.32C115.562 119.227 119 115.782 119 111.532V49.9986C119 45.7492 115.562 42.3042 111.32 42.3042H46.0641C43.9435 42.3042 42.2265 44.0245 42.2265 46.1492V73.0732C42.2265 75.1978 43.9435 76.9182 46.0641 76.9182H80.6111C82.7317 76.9182 84.4487 78.6386 84.4487 80.7633C84.4487 82.8879 82.7317 84.6083 80.6111 84.6083H46.0641C39.7024 84.6083 34.547 79.4429 34.547 73.0689V46.1449C34.547 39.7709 39.7024 34.6055 46.0641 34.6055V34.6141Z" fill="url(#logo-gradient)"/>
|
||||
<path d="M115.158 134.615H51.8291V142.306H115.158C117.279 142.306 118.996 140.585 118.996 138.461C118.996 136.336 117.279 134.615 115.158 134.615Z" fill="url(#logo-gradient)"/>
|
||||
<defs>
|
||||
<linearGradient id="logo-gradient" x1="59.5" y1="0" x2="59.5" y2="142.306" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#fdba74"/>
|
||||
<stop offset="1" stop-color="#f97316"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -253,6 +253,8 @@
|
||||
--color-surface-800: var(--color-stone-800);
|
||||
--color-surface-900: var(--color-stone-900);
|
||||
--color-surface-950: var(--color-stone-950);
|
||||
--color-logo-start: #fdba74;
|
||||
--color-logo-end: #f97316;
|
||||
}
|
||||
|
||||
.dark[data-app-theme="grimmory"] {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover">
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; worker-src 'self' blob:; frame-src 'self' blob: data:; object-src 'none'; form-action 'none';">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
|
||||
<link rel="shortcut icon" type="image/svg+xml" href="assets/favicon.svg?b280ce4c57cf230e7fac0e7cdb8fc093"/>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico?631c796fee33600b8a45c5a7d1c04f4b"/>
|
||||
<link rel="shortcut icon" type="image/svg+xml" href="assets/favicon.svg?7f5da707b7bf6f39f49765a2caa0bd95"/>
|
||||
<link rel="manifest" href="manifest.webmanifest">
|
||||
</head>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user