fix(gtk): bypass fragile SVG recoloring with static palette assets
Some checks failed
Check / eval (push) Failing after 4m37s
Some checks failed
Check / eval (push) Failing after 4m37s
GTK's -gtk-recolor proved too fragile across different contexts, failing to substitute the foreground color even when the SVG path used #000000. Instead, we now generate two statically colored SVGs (normal + hover) directly from the Nix palette hex codes, bypassing GTK's SVG recoloring engine entirely.
This commit is contained in:
@@ -43,9 +43,14 @@ let
|
|||||||
# Connections" opens a submenu). Same trick adw-gtk3 uses for its
|
# Connections" opens a submenu). Same trick adw-gtk3 uses for its
|
||||||
# check marks: a bundled asset via -gtk-recolor(url(…)), immune to
|
# check marks: a bundled asset via -gtk-recolor(url(…)), immune to
|
||||||
# icon-pack coverage. Shape traced from Adwaita's pan-end-symbolic.
|
# icon-pack coverage. Shape traced from Adwaita's pan-end-symbolic.
|
||||||
panEndSvg = pkgs.writeText "nomarchy-pan-end-symbolic.svg" ''
|
panEndSvg = pkgs.writeText "nomarchy-pan-end.svg" ''
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||||
<path fill="#000000" d="M 6 4 L 10 8 L 6 12 Z"/>
|
<path fill="#${base16.base05}" d="M 6 4 L 10 8 L 6 12 Z"/>
|
||||||
|
</svg>
|
||||||
|
'';
|
||||||
|
panEndHoverSvg = pkgs.writeText "nomarchy-pan-end-hover.svg" ''
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||||
|
<path fill="#${base16.base00}" d="M 6 4 L 10 8 L 6 12 Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
@@ -80,19 +85,24 @@ in
|
|||||||
menu menuitem:disabled, .menu menuitem:disabled {
|
menu menuitem:disabled, .menu menuitem:disabled {
|
||||||
color: #${base16.base03};
|
color: #${base16.base03};
|
||||||
}
|
}
|
||||||
/* Submenu disclosure arrows — bundled asset, NOT an icon-theme
|
/* Submenu disclosure arrows — bundled assets, NOT an icon-theme
|
||||||
lookup: pan-end-symbolic is missing from Papirus and its
|
lookup: pan-end-symbolic is missing from Papirus and its
|
||||||
broken inheritance chain, so -gtk-icontheme() drew nothing. */
|
broken inheritance chain, so -gtk-icontheme() drew nothing.
|
||||||
|
Hard-tinted directly from the palette to bypass GTK's fragile
|
||||||
|
-gtk-recolor behavior. */
|
||||||
menu menuitem arrow, .menu menuitem arrow,
|
menu menuitem arrow, .menu menuitem arrow,
|
||||||
menu menuitem:hover arrow, menu menuitem:selected arrow {
|
menu menuitem:hover arrow, menu menuitem:selected arrow {
|
||||||
min-width: 16px;
|
min-width: 16px;
|
||||||
min-height: 16px;
|
min-height: 16px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
-gtk-icon-source: -gtk-recolor(url("${panEndSvg}"));
|
}
|
||||||
|
menu menuitem arrow, .menu menuitem arrow {
|
||||||
|
-gtk-icon-source: url("file://${panEndSvg}");
|
||||||
}
|
}
|
||||||
menu menuitem:hover arrow, menu menuitem:selected arrow {
|
menu menuitem:hover arrow, menu menuitem:selected arrow {
|
||||||
color: #${base16.base00};
|
color: #${base16.base00};
|
||||||
|
-gtk-icon-source: url("file://${panEndHoverSvg}");
|
||||||
}
|
}
|
||||||
check, radio {
|
check, radio {
|
||||||
min-width: 14px;
|
min-width: 14px;
|
||||||
|
|||||||
Reference in New Issue
Block a user