> For the complete documentation index, see [llms.txt](https://docs.pkgforge.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pkgforge.dev/sbuild/specification/12.icon.md).

# 12.Icon

{% code overflow="wrap" %}

```yaml
#Example ONLY
icon:
 #Can contain one of (or all of): url, file, dir
 #If it contains multiple (or all), the builder WILL STOP UPON FIRST successful Icon/Log file MATCH (Tries PNG, else SVG)
  url: "#A Direct RAW URL to download a icon/logo file"
  file: "#A Direct PATH to a icon/logo file from ${SBUILD_OUTDIR} | ${SBUILD_TMPDIR}"
  dir: "#A Direct PATH to a Directory that contains at least 1 icon/logo"
```

{% endcode %}

* [x] This is Optional & can be left empty or removed completely (**TYPE**:<mark style="color:blue;">**`NON_ENFORCED`**</mark>)
* [x] Only One entry is supported
* [x] If <mark style="color:purple;">**`$pkg_type`**</mark> is a [binary format](/formats/binaries.md), then this is used only for <mark style="color:blue;">**`soar`**</mark><mark style="color:orange;">**`query/info`**</mark>
* [x] If <mark style="color:purple;">**`$pkg_type`**</mark> is a [package format](/formats/packages.md) like [AppImage](/formats/packages/appimage.md), [FlatImage](/formats/packages/flatimage.md), then it is downloaded & saved as <mark style="color:orange;">**`.DirIcon`**</mark> as <mark style="color:orange;">**`${SBUILD_OUTDIR}/.DirIcon`**</mark>
* [x] If used, it can only contain (One of these or all):

> - [x] <mark style="color:purple;">**`url`**</mark> : Is always preferred as the <mark style="color:orange;">**1st Choice**</mark>, even if used with others
> - [x] <mark style="color:purple;">**`file`**</mark> : Is ONLY preferred, if <mark style="color:purple;">**`url`**</mark> was **non-existent/empty**, as the <mark style="color:orange;">**2nd Choice**</mark>
> - [x] <mark style="color:purple;">**`dir`**</mark> : Is ONLY preferred, if both <mark style="color:purple;">**`url`**</mark> & <mark style="color:purple;">**`file`**</mark> are **non-existent/empty**, as the <mark style="color:orange;">**3rd & Final Choice**</mark>

{% code overflow="wrap" %}

```yaml
#Another Example
icon:
 #Can contain one of (or all of): url, file, dir
  url: "https://example.com/example.png"
  #If you only use `/example.png` or `example.png`, it is assumed as: ${SBUILD_OUTDIR}/example.png
  #Here, we specify explictly to use ${SBUILD_TMPDIR}
  file: "${SBUILD_TMPDIR}/example.png" 
  #You can just use `/usr/share` or `usr/share`, it is assumed as: ${SBUILD_OUTDIR}/usr/share
  dir: "usr/share" #will search in ${SBUILD_OUTDIR}/usr/share
```

{% endcode %}

{% hint style="info" %} <mark style="color:purple;">**`file`**</mark> supports wildcard glob (<mark style="color:orange;">**`*`**</mark>) pattern

{% code overflow="wrap" %}

```yaml
icon:
#Will search for a *.png file in ${SBUILD_TMPDIR} (picks first match)
  file: "${SBUILD_TMPDIR}/*.png"
```

{% endcode %}
{% endhint %}

{% hint style="info" %} <mark style="color:purple;">**`dir`**</mark> supports wildcard glob (<mark style="color:orange;">**`*`**</mark>) pattern

<pre class="language-yaml"><code class="lang-yaml">icon:
  dir: "${SBUILD_OUTDIR}/usr/share/applications/icons*" 
#Will search inside all these dir (picks first png, else first svg):
<strong># ${SBUILD_OUTDIR}/usr/share/applications/icons128
</strong><strong># ${SBUILD_OUTDIR}/usr/share/applications/icons256
</strong># ${SBUILD_OUTDIR}/usr/share/applications/iconsXYZ
</code></pre>

{% endhint %}

{% hint style="info" %}

* This <mark style="color:red;">**MAY BE OVERWRITTEN**</mark>, if <mark style="color:purple;">**`x_exec.run`**</mark> does something to the file (example: It produces it's own <mark style="color:orange;">**`${SBUILD_PKG}.{png|svg}`**</mark> file)**,** otherwise is used as the default <mark style="color:orange;">**`.DirIcon`**</mark> & <mark style="color:orange;">**`${SBUILD_OUTDIR}/${SBUILD_PKG}.png`**</mark> file
* The <mark style="color:purple;">**`icon`**</mark> file is renamed to <mark style="color:orange;">**`${SBUILD_OUTDIR}/${SBUILD_PKG}.{png|svg}`**</mark>based on the <mark style="color:blue;">**ImageType**</mark>
  {% endhint %}
