Packaging/Icons/zh: Difference between revisions
Appearance
Created page with "应用图标应该被安装于 <code>$out/share/icons/hicolor</code>。" Tags: Mobile edit Mobile web edit |
Created page with "现已过时的 [https://github.com/nixos/nixpkgs/blob/c8e5c5c2228ddd58f01b7229e0bb4a92a9585990/pkgs/applications/office/scribus/1_4.nix scribus v1.4] 应用程序的示例代码:" Tags: Mobile edit Mobile web edit |
||
Line 4: | Line 4: | ||
应用图标应该被安装于 <code>$out/share/icons/hicolor</code>。 | 应用图标应该被安装于 <code>$out/share/icons/hicolor</code>。 | ||
现已过时的 [https://github.com/nixos/nixpkgs/blob/c8e5c5c2228ddd58f01b7229e0bb4a92a9585990/pkgs/applications/office/scribus/1_4.nix scribus v1.4] 应用程序的示例代码: | |||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> |
Revision as of 18:57, 28 August 2025
应用图标
应用图标应该被安装于 $out/share/icons/hicolor
。
现已过时的 scribus v1.4 应用程序的示例代码:
{ lib
, stdenv
, fetchurl
, imagemagick
}:
let
icon = fetchurl {
url = "https://gist.githubusercontent.com/ejpcmac/a74b762026c9bc4000be624c3d085517/raw/18edc497c5cb6fdeef1c8aede37a0ee68413f9d3/scribus-icon-centered.svg";
sha256 = "0hq3i7c2l50445an9glhhg47kj26y16svfajc6naqn307ph9vzc3";
};
in
stdenv.mkDerivation rec {
pname = "scribus";
nativeBuildInputs = [
imagemagick # convert
];
# ...
postInstall = ''
for i in 16 24 48 64 96 128 256 512; do
mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
convert -background none -resize ''${i}x''${i} ${icon} $out/share/icons/hicolor/''${i}x''${i}/apps/${pname}.png
done
'';
}
-background none
will create transparent icons.
Alternative: -background white
.
See also
Another example handling icons obsidian.