btcpayserver/BTCPayServer/Views/Shared/LayoutHeadStoreBranding.cshtml
d11n 4c303d358b
Branding updates for 2.0 (#5947)
* Remove deprecated CSS options

Closes #5945.

* Greenfield: Add brandColor to store APIs

Closes #5946.

* Migrate file IDs to URLs

Closes #5953.

* Greenfield: Add CSS and logo URL to store settings API

Closes #5945.

* Add migration test

* Store and Server branding can reference file's via fileid:ID

* Add PaymentSoundUrl to Store API

---------

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
2024-05-09 09:18:02 +09:00

40 lines
1.4 KiB
Text

@model StoreBrandingViewModel
@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(Model.CssUrl))
{
<link href="@Model.CssUrl!" asp-append-version="true" rel="stylesheet" />
}
@if (!string.IsNullOrEmpty(Model.LogoUrl))
{
<link rel="icon" href="@Model.LogoUrl">
<link rel="apple-touch-icon" href="@Model.LogoUrl">
}