mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
* Store Branding: Refactoring and logo as favicon - Encapsulates store branding properties into their own view model - Uses the logo as favicon on public pages * Refactorings * Updates
61 lines
2.1 KiB
Text
61 lines
2.1 KiB
Text
@model StoreBrandingViewModel
|
|
@using BTCPayServer.Abstractions.Contracts
|
|
@inject IFileService FileService
|
|
@{
|
|
var logoUrl = !string.IsNullOrEmpty(Model.LogoFileId)
|
|
? await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.LogoFileId)
|
|
: null;
|
|
var cssUrl = !string.IsNullOrEmpty(Model.CssFileId)
|
|
? await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.CssFileId)
|
|
: null;
|
|
}
|
|
@if (!string.IsNullOrEmpty(Model.BrandColor))
|
|
{
|
|
var brand = Model.BrandColor;
|
|
var brandColor = ColorPalette.Default.FromHtml(brand);
|
|
var brandRgbValues = $"{brandColor.R}, {brandColor.G}, {brandColor.B}";
|
|
var accent = ColorPalette.Default.AdjustBrightness(brand, (float)-0.15);
|
|
var complement = ColorPalette.Default.TextColor(brand);
|
|
var complementVar = $"var(--btcpay-{(complement == "black" ? "black" : "white")})";
|
|
<style>
|
|
:root {
|
|
--btcpay-primary: @brand;
|
|
--btcpay-primary-rgb: @brandRgbValues;
|
|
--btcpay-primary-shadow: @brand;
|
|
--btcpay-primary-bg-hover: @accent;
|
|
--btcpay-primary-bg-active: @accent;
|
|
--btcpay-body-link: @brand;
|
|
--btcpay-body-link-accent: @accent;
|
|
--btcpay-primary-text: @complementVar;
|
|
--btcpay-primary-text-hover: @complementVar;
|
|
--btcpay-primary-text-active: @complementVar;
|
|
}
|
|
a {
|
|
color: var(--btcpay-body-link);
|
|
}
|
|
a:hover {
|
|
color: var(--btcpay-body-link-accent);
|
|
}
|
|
</style>
|
|
<meta name="theme-color" content="@brand">
|
|
}
|
|
@if (!string.IsNullOrEmpty(cssUrl))
|
|
{
|
|
<link href="@cssUrl" asp-append-version="true" rel="stylesheet" />
|
|
}
|
|
@* Deprecated, but added for backwards-compatibility *@
|
|
@if (!string.IsNullOrEmpty(Model.CustomCSSLink))
|
|
{
|
|
<link href="@Model.CustomCSSLink" asp-append-version="true" rel="stylesheet" />
|
|
}
|
|
@if (!string.IsNullOrEmpty(Model.EmbeddedCSS))
|
|
{
|
|
<style>
|
|
@Safe.Raw(Model.EmbeddedCSS)
|
|
</style>
|
|
}
|
|
@if (!string.IsNullOrEmpty(logoUrl))
|
|
{
|
|
<link rel="icon" href="@logoUrl">
|
|
<link rel="apple-touch-icon" href="@logoUrl">
|
|
}
|