fix
This commit is contained in:
@@ -21,6 +21,7 @@ let
|
|||||||
+ "|mstile-[0-9]+x[0-9]+\\.png)$";
|
+ "|mstile-[0-9]+x[0-9]+\\.png)$";
|
||||||
configFile = pkgs.writeText "favicon-config.json" (builtins.toJSON {
|
configFile = pkgs.writeText "favicon-config.json" (builtins.toJSON {
|
||||||
inherit cacheControl;
|
inherit cacheControl;
|
||||||
|
borderRadius = config.colorScheme.palette.border-radius;
|
||||||
mappings = hostMappings;
|
mappings = hostMappings;
|
||||||
default = containerCfg.extra.default or null;
|
default = containerCfg.extra.default or null;
|
||||||
});
|
});
|
||||||
@@ -104,28 +105,36 @@ let
|
|||||||
return "data:image/svg+xml;base64," + base64.b64encode(svg.encode("utf-8")).decode("ascii")
|
return "data:image/svg+xml;base64," + base64.b64encode(svg.encode("utf-8")).decode("ascii")
|
||||||
|
|
||||||
|
|
||||||
|
def _border_radius():
|
||||||
|
value = APP_CONFIG.get("borderRadius", "8")
|
||||||
|
text = str(value).strip()
|
||||||
|
if text.endswith("px"):
|
||||||
|
return text
|
||||||
|
return f"{text}px"
|
||||||
|
|
||||||
|
|
||||||
def _render_svg(profile):
|
def _render_svg(profile):
|
||||||
bg = _color(profile.get("background"), "#111827")
|
bg = _color(profile.get("background"), "#111827")
|
||||||
fg = _color(profile.get("foreground"), "#f8fafc")
|
fg = _color(profile.get("foreground"), "#f8fafc")
|
||||||
accent = _color(profile.get("accent"), "#38bdf8")
|
accent = _color(profile.get("accent"), "#38bdf8")
|
||||||
badge = _badge_text(profile)
|
badge = _badge_text(profile)
|
||||||
|
border_radius = _border_radius()
|
||||||
logo_data_uri = _tinted_logo_data_uri(fg)
|
logo_data_uri = _tinted_logo_data_uri(fg)
|
||||||
|
|
||||||
canvas = 256
|
canvas = 256
|
||||||
circle_radius = 120
|
|
||||||
badge_svg = ""
|
badge_svg = ""
|
||||||
if badge:
|
if badge:
|
||||||
badge_svg = f"""
|
badge_svg = f"""
|
||||||
<text x="196" y="72"
|
<text x="196" y="72"
|
||||||
font-family="DejaVu Sans, sans-serif"
|
font-family="DejaVu Sans, sans-serif"
|
||||||
font-size="52"
|
font-size="72"
|
||||||
font-weight="700"
|
font-weight="900"
|
||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
fill="{accent}">{badge}</text>
|
fill="{accent}">{badge}</text>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return f"""<svg xmlns="http://www.w3.org/2000/svg" width="{canvas}" height="{canvas}" viewBox="0 0 {canvas} {canvas}">
|
return f"""<svg xmlns="http://www.w3.org/2000/svg" width="{canvas}" height="{canvas}" viewBox="0 0 {canvas} {canvas}">
|
||||||
<circle cx="128" cy="128" r="{circle_radius}" fill="{bg}" />
|
<rect x="0" y="0" width="{canvas}" height="{canvas}" rx="{border_radius}" ry="{border_radius}" fill="{bg}" />
|
||||||
<image href="{logo_data_uri}" x="0" y="0" width="{canvas}" height="{canvas}" preserveAspectRatio="xMidYMid meet" />
|
<image href="{logo_data_uri}" x="0" y="0" width="{canvas}" height="{canvas}" preserveAspectRatio="xMidYMid meet" />
|
||||||
{badge_svg}
|
{badge_svg}
|
||||||
</svg>"""
|
</svg>"""
|
||||||
|
|||||||
Reference in New Issue
Block a user