Skip to content

Truly independent web browser

UI: Give the macOS app an Icon Composer icon

Andreas Kling962a4c876ceb
diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt
index 7eb2b4c40ad..cb90dc614d7 100644
--- a/UI/CMakeLists.txt
+++ b/UI/CMakeLists.txt
@@ -6,6 +6,16 @@ if (APPLE)
else()
set(LADYBIRD_ENTITLEMENTS_FILE "${LADYBIRD_SOURCE_DIR}/Meta/Entitlements.plist")
endif()
+
+ # Icon Composer icons need the asset catalog compiler from Xcode 26 or later.
+ execute_process(COMMAND xcrun actool --version OUTPUT_VARIABLE actool_version ERROR_QUIET)
+ if (actool_version MATCHES "<key>short-bundle-version</key>[ \t\r\n]*<string>([0-9]+)" AND CMAKE_MATCH_1 GREATER_EQUAL 26)
+ set(LADYBIRD_COMPILE_ICON_COMPOSER_ICON TRUE)
+ set(LADYBIRD_ICON_COMPOSER_PLIST_ENTRY "<key>CFBundleIconName</key>\n <string>AppIcon</string>")
+ else()
+ set(LADYBIRD_ICON_COMPOSER_PLIST_ENTRY "")
+ message(STATUS "actool is older than Xcode 26, so the app bundle only gets the flat icon")
+ endif()
endif()
function(create_ladybird_bundle target_name)
@@ -38,6 +48,30 @@ function(create_ladybird_bundle target_name)
COMMAND "iconutil" --convert icns "${LADYBIRD_SOURCE_DIR}/UI/Icons/macos/app_icon.iconset" --output "${bundle_dir}/Contents/Resources/app_icon.icns"
)
+ # macOS 26 and later show the Icon Composer icon from the asset catalog, which adapts to the system's icon
+ # styles. Earlier versions show the flat app_icon.icns.
+ if (LADYBIRD_COMPILE_ICON_COMPOSER_ICON)
+ set(icon_composer_icon "${LADYBIRD_SOURCE_DIR}/UI/Icons/macos/AppIcon.icon")
+ set_property(TARGET ${target_name} APPEND PROPERTY LINK_DEPENDS
+ "${icon_composer_icon}/icon.json"
+ "${icon_composer_icon}/Assets/mark.svg"
+ "${icon_composer_icon}/Assets/mark-dark.svg"
+ "${icon_composer_icon}/Assets/mark-mono.svg"
+ )
+
+ set(asset_catalog_dir "${CMAKE_CURRENT_BINARY_DIR}/${target_name}_asset_catalog")
+ add_custom_command(TARGET ${target_name} POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E make_directory "${asset_catalog_dir}"
+ COMMAND xcrun actool "${icon_composer_icon}" --compile "${asset_catalog_dir}"
+ --app-icon AppIcon --platform macosx --target-device mac
+ --minimum-deployment-target "${CMAKE_OSX_DEPLOYMENT_TARGET}"
+ --output-partial-info-plist "${asset_catalog_dir}/partial.plist"
+ --errors --warnings --output-format human-readable-text
+ COMMAND "${CMAKE_COMMAND}" -E copy "${asset_catalog_dir}/Assets.car" "${bundle_dir}/Contents/Resources/Assets.car"
+ VERBATIM
+ )
+ endif()
+
# Note: This symlink is removed in the install commands
# This makes the bundle in the build directory *NOT* relocatable
add_custom_command(TARGET ${target_name} POST_BUILD
diff --git a/UI/Icons/macos/AppIcon.icon/Assets/mark-dark.svg b/UI/Icons/macos/AppIcon.icon/Assets/mark-dark.svg
new file mode 100644
index 00000000000..9388b8193a8
--- /dev/null
+++ b/UI/Icons/macos/AppIcon.icon/Assets/mark-dark.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
+<path d="M512.00 512.00 L550.82 558.92 L589.08 603.88 L625.66 644.93 L660.01 680.12 L691.57 708.05 L719.50 727.04 L743.52 737.09 L763.07 737.09 L777.59 727.04 L787.08 708.05 L790.99 680.12 L789.88 644.93 L782.89 603.88 L770.89 558.92 L753.85 512.00 L732.07 465.08 L706.09 420.12 L676.21 379.07 L642.98 343.88 L607.51 315.95 L570.09 296.96 L531.55 286.91 L492.45 286.91 L453.91 296.96 L416.49 315.95 L381.02 343.88 L347.79 379.07 L317.91 420.12 L291.93 465.08 L270.15 512.00 L253.11 558.92 L241.11 603.88 L234.12 644.93 L233.01 680.12 L236.92 708.05 L246.41 727.04 L260.93 737.09 L280.48 737.09 L304.50 727.04 L332.43 708.05 L363.99 680.12 L398.34 644.93 L434.92 603.88 L473.18 558.92 L512.00 512.00 L550.82 465.08 L589.08 420.12 L625.66 379.07 L660.01 343.88 L691.57 315.95 L719.50 296.96 L743.52 286.91 L763.07 286.91 L777.59 296.96 L787.08 315.95 L790.99 343.88 L789.88 379.07 L782.89 420.12 L770.89 465.08 L753.85 512.00 L732.07 558.92 L706.09 603.88 L676.21 644.93 L642.98 680.12 L607.51 708.05 L570.09 727.04 L531.55 737.09 L492.45 737.09 L453.91 727.04 L416.49 708.05 L381.02 680.12 L347.79 644.93 L317.91 603.88 L291.93 558.92 L270.15 512.00 L253.11 465.08 L241.11 420.12 L234.12 379.07 L233.01 343.88 L236.92 315.95 L246.41 296.96 L260.93 286.91 L280.48 286.91 L304.50 296.96 L332.43 315.95 L363.99 343.88 L398.34 379.07 L434.92 420.12 L473.18 465.08 Z
+" fill="none" stroke="#a684ff" stroke-width="43.29" stroke-linejoin="round"/>
+</svg>
diff --git a/UI/Icons/macos/AppIcon.icon/Assets/mark-mono.svg b/UI/Icons/macos/AppIcon.icon/Assets/mark-mono.svg
new file mode 100644
index 00000000000..6576d0a08b6
--- /dev/null
+++ b/UI/Icons/macos/AppIcon.icon/Assets/mark-mono.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
+<path d="M512.00 512.00 L550.82 558.92 L589.08 603.88 L625.66 644.93 L660.01 680.12 L691.57 708.05 L719.50 727.04 L743.52 737.09 L763.07 737.09 L777.59 727.04 L787.08 708.05 L790.99 680.12 L789.88 644.93 L782.89 603.88 L770.89 558.92 L753.85 512.00 L732.07 465.08 L706.09 420.12 L676.21 379.07 L642.98 343.88 L607.51 315.95 L570.09 296.96 L531.55 286.91 L492.45 286.91 L453.91 296.96 L416.49 315.95 L381.02 343.88 L347.79 379.07 L317.91 420.12 L291.93 465.08 L270.15 512.00 L253.11 558.92 L241.11 603.88 L234.12 644.93 L233.01 680.12 L236.92 708.05 L246.41 727.04 L260.93 737.09 L280.48 737.09 L304.50 727.04 L332.43 708.05 L363.99 680.12 L398.34 644.93 L434.92 603.88 L473.18 558.92 L512.00 512.00 L550.82 465.08 L589.08 420.12 L625.66 379.07 L660.01 343.88 L691.57 315.95 L719.50 296.96 L743.52 286.91 L763.07 286.91 L777.59 296.96 L787.08 315.95 L790.99 343.88 L789.88 379.07 L782.89 420.12 L770.89 465.08 L753.85 512.00 L732.07 558.92 L706.09 603.88 L676.21 644.93 L642.98 680.12 L607.51 708.05 L570.09 727.04 L531.55 737.09 L492.45 737.09 L453.91 727.04 L416.49 708.05 L381.02 680.12 L347.79 644.93 L317.91 603.88 L291.93 558.92 L270.15 512.00 L253.11 465.08 L241.11 420.12 L234.12 379.07 L233.01 343.88 L236.92 315.95 L246.41 296.96 L260.93 286.91 L280.48 286.91 L304.50 296.96 L332.43 315.95 L363.99 343.88 L398.34 379.07 L434.92 420.12 L473.18 465.08 Z
+" fill="none" stroke="#ffffff" stroke-width="50.27" stroke-linejoin="round"/>
+</svg>
diff --git a/UI/Icons/macos/AppIcon.icon/Assets/mark.svg b/UI/Icons/macos/AppIcon.icon/Assets/mark.svg
new file mode 100644
index 00000000000..81ed2c4cdf5
--- /dev/null
+++ b/UI/Icons/macos/AppIcon.icon/Assets/mark.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
+<path d="M512.00 512.00 L550.82 558.92 L589.08 603.88 L625.66 644.93 L660.01 680.12 L691.57 708.05 L719.50 727.04 L743.52 737.09 L763.07 737.09 L777.59 727.04 L787.08 708.05 L790.99 680.12 L789.88 644.93 L782.89 603.88 L770.89 558.92 L753.85 512.00 L732.07 465.08 L706.09 420.12 L676.21 379.07 L642.98 343.88 L607.51 315.95 L570.09 296.96 L531.55 286.91 L492.45 286.91 L453.91 296.96 L416.49 315.95 L381.02 343.88 L347.79 379.07 L317.91 420.12 L291.93 465.08 L270.15 512.00 L253.11 558.92 L241.11 603.88 L234.12 644.93 L233.01 680.12 L236.92 708.05 L246.41 727.04 L260.93 737.09 L280.48 737.09 L304.50 727.04 L332.43 708.05 L363.99 680.12 L398.34 644.93 L434.92 603.88 L473.18 558.92 L512.00 512.00 L550.82 465.08 L589.08 420.12 L625.66 379.07 L660.01 343.88 L691.57 315.95 L719.50 296.96 L743.52 286.91 L763.07 286.91 L777.59 296.96 L787.08 315.95 L790.99 343.88 L789.88 379.07 L782.89 420.12 L770.89 465.08 L753.85 512.00 L732.07 558.92 L706.09 603.88 L676.21 644.93 L642.98 680.12 L607.51 708.05 L570.09 727.04 L531.55 737.09 L492.45 737.09 L453.91 727.04 L416.49 708.05 L381.02 680.12 L347.79 644.93 L317.91 603.88 L291.93 558.92 L270.15 512.00 L253.11 465.08 L241.11 420.12 L234.12 379.07 L233.01 343.88 L236.92 315.95 L246.41 296.96 L260.93 286.91 L280.48 286.91 L304.50 296.96 L332.43 315.95 L363.99 343.88 L398.34 379.07 L434.92 420.12 L473.18 465.08 Z
+" fill="none" stroke="#6a39db" stroke-width="43.29" stroke-linejoin="round"/>
+</svg>
diff --git a/UI/Icons/macos/AppIcon.icon/icon.json b/UI/Icons/macos/AppIcon.icon/icon.json
new file mode 100644
index 00000000000..a707379559e
--- /dev/null
+++ b/UI/Icons/macos/AppIcon.icon/icon.json
@@ -0,0 +1,57 @@
+{
+ "fill" : {
+ "linear-gradient" : [
+ "srgb:0.96078,0.94902,0.98431,1.00000",
+ "srgb:0.91373,0.89804,0.94902,1.00000"
+ ]
+ },
+ "fill-specializations" : [
+ {
+ "appearance" : "dark",
+ "value" : {
+ "linear-gradient" : [
+ "srgb:0.17255,0.16471,0.20000,1.00000",
+ "srgb:0.11373,0.10980,0.13333,1.00000"
+ ]
+ }
+ }
+ ],
+ "groups" : [
+ {
+ "layers" : [
+ {
+ "glass" : false,
+ "image-name-specializations" : [
+ {
+ "value" : "mark.svg"
+ },
+ {
+ "appearance" : "dark",
+ "value" : "mark-dark.svg"
+ },
+ {
+ "appearance" : "tinted",
+ "value" : "mark-mono.svg"
+ }
+ ],
+ "name" : "Mark"
+ }
+ ],
+ "name" : "Mark",
+ "shadow" : {
+ "kind" : "none",
+ "opacity" : 0.5
+ },
+ "specular" : false,
+ "translucency" : {
+ "enabled" : false,
+ "value" : 0.5
+ }
+ }
+ ],
+ "supported-platforms" : {
+ "squares" : [
+ "macOS"
+ ]
+ }
+}
diff --git a/UI/Info.plist b/UI/Info.plist
index 7af30bce2d0..7d4fef148fd 100644
--- a/UI/Info.plist
+++ b/UI/Info.plist
@@ -6,6 +6,7 @@
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>app_icon.icns</string>
+ ${LADYBIRD_ICON_COMPOSER_PLIST_ENTRY}
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>