aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2022-12-10 21:46:34 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-19 20:34:48 +0000
commit241f68b543de62a800ff5cbf6c06580d45ab8a13 (patch)
tree47bcbff48615deee79ef7c6c22eeea13fdf1c8d3
parent1d509dc81961f182629bf0bfd48eed7941122fab (diff)
downloadpuzzles-241f68b543de62a800ff5cbf6c06580d45ab8a13.zip
puzzles-241f68b543de62a800ff5cbf6c06580d45ab8a13.tar.gz
puzzles-241f68b543de62a800ff5cbf6c06580d45ab8a13.tar.bz2
puzzles-241f68b543de62a800ff5cbf6c06580d45ab8a13.tar.xz
Properly-styled icons for KaiOS
These are built alongside other icons as part of the GTK build. It builds new icon sizes of 44 and 88 pixels and then uses ImageMagick to round off the corners and add a shadow in accordance with the KaiOS design guide.
-rw-r--r--icons/icons.cmake29
1 files changed, 28 insertions, 1 deletions
diff --git a/icons/icons.cmake b/icons/icons.cmake
index 2cbdf58..dbfc39c 100644
--- a/icons/icons.cmake
+++ b/icons/icons.cmake
@@ -81,14 +81,16 @@ set(untangle_crop 320x320 164x164+3+116)
add_custom_target(icons)
# All sizes of icon we make for any purpose.
-set(all_icon_sizes 96 48 32 16)
+set(all_icon_sizes 96 88 48 44 32 16)
# Sizes of icon we put into the Windows .ico files.
set(win_icon_sizes 48 32 16)
# Border thickness for each icon size.
set(border_96 4)
+set(border_88 4)
set(border_48 4)
+set(border_44 4)
set(border_32 2)
set(border_16 1)
@@ -247,6 +249,31 @@ function(build_icon name)
${cicon_pl_infiles})
list(APPEND output_icon_files ${icon_bindir}/${name}-icon.c)
+ # Make the KaiOS icons, which have rounded corners and shadows
+ # https://developer.kaiostech.com/docs/design-guide/launcher-icon
+ foreach(size 56 112)
+ math(EXPR srciconsize "${size} * 44 / 56")
+ math(EXPR borderwidth "(${size} - ${srciconsize}) / 2")
+ math(EXPR cornerradius "${size} * 5 / 56")
+ math(EXPR sizeminusone "${srciconsize} - 1")
+ math(EXPR shadowspread "${size} * 4 / 56")
+ math(EXPR shadowoffset "${size} * 2 / 56")
+ add_custom_command(OUTPUT ${icon_bindir}/${name}-${size}kai.png
+ COMMAND ${CONVERT}
+ ${icon_bindir}/${name}-${srciconsize}d24.png
+ -alpha Opaque
+ "\\(" -size ${srciconsize}x${srciconsize} -depth 8 canvas:none
+ -draw "roundRectangle 0,0,${sizeminusone},${sizeminusone},${cornerradius},${cornerradius}" "\\)"
+ -compose dst-in -composite
+ -compose over -bordercolor transparent -border ${borderwidth}
+ "\\(" +clone -background black
+ -shadow 30x${shadowspread}+0+${shadowoffset} "\\)"
+ +swap -background none -flatten -crop '${size}x${size}+0+0!' -depth 8
+ ${icon_bindir}/${name}-${size}kai.png
+ DEPENDS ${icon_bindir}/${name}-${srciconsize}d24.png)
+ list(APPEND output_icon_files ${icon_bindir}/${name}-${size}kai.png)
+ endforeach()
+
add_custom_target(${name}-icons DEPENDS ${output_icon_files})
add_dependencies(icons ${name}-icons)
endfunction()