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()