<script lang="ts">
	import type { BrandConfig } from '$lib/config';

	export let brand: BrandConfig = {};
	export let color = 'var(--text)';
	console.log(brand);

	function masked() {
		return brand.logo != undefined && brand.asmask == true;
	}
</script>

<div style="--mask: url({brand.logo || ''}); --mask-color: {color}" class:masked={masked()}>
	{#if brand.logo}
		{#if brand.asmask != true}
			<img src={brand.logo} alt="logo" />
		{/if}
	{:else if brand.icon}
		<i class={brand.icon} />
	{/if}
</div>

<style>
	div {
		width: 100%;
		height: 100%;
		color: var(--mask-color);
	}

	img {
		width: 100%;
	}

	.masked {
		background: var(--mask-color);
		mask: var(--mask) center no-repeat;
		mask-size: 100%;
		-webkit-mask: var(--mask) center no-repeat;
		-webkit-mask-size: 100%;
	}
</style>
