Skip to main content

Module icon

Module icon 

Source
Expand description

Application icons. Without [app].icon every target uses the Bern logo; with it, the declared square PNG. [app.icon] can also give a platform its own icon: another square PNG, or the icon in the platform’s own form (an .icns file, an .ico file, an .appiconset folder, an Icon Composer .icon folder for macOS and iOS, a tvOS .brandassets folder, an Android res folder, an icon theme folder, a folder of page icons), which is shipped as it is. The platform containers (.ico on Windows, .icns on macOS) hold PNG images as they are, so nothing here decodes or scales pixels: the logo ships pre-rendered at every size the platforms ask for, and a declared PNG is used at its own size. Only tvOS’s layered icon is drawn from the square one, in crate::brand_assets.

Structs§

AndroidRes
The files of an Android res folder with a launcher icon.
Image
One PNG image of an icon.
ThemeIcon
One application icon in an icon theme folder.

Enums§

Shape
How a platform shows application icons.
Source
Where one platform’s icon comes from.

Constants§

ADAPTIVE_SIDE
The side of an Android adaptive icon’s layers in pixels: 108 dp at the density of mipmap-xxxhdpi.
DECLARED_SIZES
Sizes a declared icon may have: the large sizes every platform scales down from.
DEFAULT_SVG
The Bern logo, the default icon, as SVG.
ON_DARK
The colour a status area’s own pictures are in on a dark bar.
ON_LIGHT
The colour a status area’s own pictures are in on a light bar.
PLATFORMS
Platforms that can have an icon of their own under [app.icon], named as [targets] names them.

Functions§

accepted
What platform takes under [app.icon], for messages.
adaptive_layers
An Android adaptive icon made from a square icon image: the foreground layer (PNG, ADAPTIVE_SIDE square) holds the image over the 72 dp in the middle that the launcher’s shape shows, and the background is the colour of the image’s corner, or white where the corner is clear. A full-bleed icon on a plate thus fills the launcher’s shape, as other apps’ icons do, instead of being shrunk inside a plate of the launcher’s own.
alternate_name
The [app.alternate_icons] name a WindowSet(icon:) variant names: Skin is skin, DarkSkin is dark_skin.
alternate_source
Where the alternate icon name comes from on platform: its own entry under [app.alternate_icons.<name>], else its default; None when it has neither.
alternates
The alternate icons WindowSet(icon:) switches to on platform, by name, with where each comes from; the error names one with nothing for the platform.
android_res
Read an Android res folder: resource folders (mipmap*, drawable*, values*) whose files make the launcher icon @mipmap/ic_launcher. Files Bern writes itself (values*/strings.xml, values*/themes.xml) cannot be in it.
app_icon_set
The files of an iOS .appiconset folder: Contents.json and the images it names, all at the top of the folder.
check
Check a declared icon: a square PNG of 256, 512 or 1024 pixels. Returns its size.
check_icns
Check a macOS icon file: entries that add up to the length it states.
check_ico
Check a Windows icon file: images inside the file.
check_native
Check an icon in platform’s own form at path, a file or a folder: an .icns file (macOS), an .ico file (Windows), an .appiconset folder (iOS), an Icon Composer .icon folder (macOS and iOS), a .brandassets folder (tvOS), a res folder (Android), an icon theme folder (Linux), or an SVG or a folder of page icons (browser).
choices
The icons WindowSet(icon:) chooses among, in its enum’s order: each variant’s name, and the alternate icon it shows (None: [app.icon], for Default). Empty when the window set does not choose.
declared
The icon written for platform: its own entry under [app.icon], else the one for every platform. Paths are relative to Bern.toml.
default_images
The logo in shape, smallest first.
files_in
The files below dir, relative to it and sorted. A symbolic link is an error: an icon names the files it ships.
icns
A macOS icon (.icns) holding the images as PNG, each under the entry types for its size (the plain and the Retina slot).
ico
A Windows icon (.ico) holding the images as PNG. Images larger than 256 pixels are kept only when there is nothing smaller, as Windows reads icons up to 256 pixels.
icon_document
The files of an Icon Composer document (an .icon folder): icon.json and the layer images it names, which sit in Assets.
images
platform’s icon as PNG images, smallest first: the logo in shape, or the declared PNG (relative to the project directory) at its own size. A platform whose icon is in its own form has no images here; read it with source.
is_default
Whether platform uses the Bern logo.
is_icon_document
Whether a declared icon is an Icon Composer document, the layered .icon folder that macOS 26 and iOS 26 draw in Liquid Glass. actool compiles it, and draws flat images from it for earlier systems.
is_png_name
Whether a declared icon is a PNG by its name.
largest
The largest image.
page_icons
Read a folder of page icons: files at its top, of the kinds a page links (.svg, .ico, .png, and a .webmanifest or manifest.json naming the icons beside it). At least one image.
png_size
Width and height of a PNG, from its header.
source
Where platform’s icon comes from.
status_image
The one-colour SVG of StatusItem(image:), a declared resource name.
status_picture
The status item’s picture, side pixels square: the SVG at path fitted and centred, its shape (what it covers, whatever its colours) in color. PNG.
status_pictures
The status item’s picture at each of sides, smallest first.
theme_icons
Read an icon theme folder laid out like hicolor: <size>/apps/<name> files, with <size> such as 48x48, 48x48@2, scalable or symbolic, all of one name (the symbolic one ends in -symbolic.svg). At least one PNG of a size. The name is replaced by the application’s.