mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
44 lines
1.6 KiB
Text
44 lines
1.6 KiB
Text
@model (string BrandColor, string CssFileId, string CustomCSSLink, string EmbeddedCSS)
|
|
@using BTCPayServer.Abstractions.Extensions
|
|
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@using BTCPayServer.Abstractions.Contracts
|
|
@inject IFileService FileService
|
|
@{
|
|
var cssUrl = !string.IsNullOrEmpty(Model.CssFileId)
|
|
? await FileService.GetFileUrl(Context.Request.GetAbsoluteRootUri(), Model.CssFileId)
|
|
: null;
|
|
}
|
|
@if (!string.IsNullOrEmpty(Model.BrandColor))
|
|
{
|
|
var brandColor = Model.BrandColor;
|
|
var accentColor = ColorPalette.Default.AdjustBrightness(brandColor, (float)-0.15);
|
|
var complement = ColorPalette.Default.TextColor(brandColor).ToLowerInvariant();
|
|
var complementColor = $"var(--btcpay-{(complement == "black" ? "black" : "white")})";
|
|
<style>
|
|
:root {
|
|
--btcpay-primary: @brandColor;
|
|
--btcpay-primary-shadow: @brandColor;
|
|
--btcpay-primary-bg-hover: @accentColor;
|
|
--btcpay-primary-bg-active: @accentColor;
|
|
--btcpay-body-link-accent: @accentColor;
|
|
--btcpay-primary-text: @complementColor;
|
|
--btcpay-primary-text-hover: @complementColor;
|
|
--btcpay-primary-text-active: @complementColor;
|
|
}
|
|
</style>
|
|
}
|
|
@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>
|
|
}
|