From de68ced39e2ae965c7658a455ee41990a809e11f Mon Sep 17 00:00:00 2001 From: me Date: Thu, 29 Jan 2026 18:24:05 +0800 Subject: [PATCH] feat: add official Slint SVG icons with theme support - Downloaded official SVG icons from Slint repository - Added square logos for file type icons (light and dark variants) - Added full logos for larger display areas - Implemented automatic theme switching (slintFile.svg / slintFile_dark.svg) - Replaced old PNG icon with scalable SVG icons - Updated SlintIcons to use IconLoader for proper SVG support Icons now properly display in IntelliJ and adapt to light/dark themes. --- .../me/zhouxi/slint/icons/SlintIcons.kt | 27 +++++++++++++------ .../resources/icons/slint-logo-full-dark.svg | 11 ++++++++ .../resources/icons/slint-logo-full-light.svg | 11 ++++++++ .../icons/slint-logo-square-dark.svg | 17 ++++++++++++ .../icons/slint-logo-square-light.svg | 17 ++++++++++++ src/main/resources/icons/slintFile.svg | 17 ++++++++++++ src/main/resources/icons/slintFile_dark.svg | 17 ++++++++++++ 7 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/icons/slint-logo-full-dark.svg create mode 100644 src/main/resources/icons/slint-logo-full-light.svg create mode 100644 src/main/resources/icons/slint-logo-square-dark.svg create mode 100644 src/main/resources/icons/slint-logo-square-light.svg create mode 100644 src/main/resources/icons/slintFile.svg create mode 100644 src/main/resources/icons/slintFile_dark.svg diff --git a/src/main/kotlin/me/zhouxi/slint/icons/SlintIcons.kt b/src/main/kotlin/me/zhouxi/slint/icons/SlintIcons.kt index be23839..d3e6cd6 100644 --- a/src/main/kotlin/me/zhouxi/slint/icons/SlintIcons.kt +++ b/src/main/kotlin/me/zhouxi/slint/icons/SlintIcons.kt @@ -1,16 +1,27 @@ package me.zhouxi.slint.icons -import com.intellij.ui.IconManager +import com.intellij.openapi.util.IconLoader import javax.swing.Icon - object SlintIcons { - private fun load(path: String, cacheKey: Int, flags: Int): Icon { - return IconManager.getInstance() - .loadRasterizedIcon(path, SlintIcons::class.java.classLoader, cacheKey, flags) - } - - val Primary: Icon = load("icons/slint-logo-small-light.png", 199921742, 2) + /** + * File type icon - 16x16 square logo that automatically adapts to light/dark theme + * IntelliJ will automatically load slintFile_dark.svg in dark mode + */ + @JvmField + val FileType: Icon = IconLoader.getIcon("/icons/slintFile.svg", SlintIcons::class.java) + /** + * Primary icon - used in various UI contexts + * Alias for FileType for backward compatibility + */ + @JvmField + val Primary: Icon = FileType + /** + * Full logo with text - for larger display areas (e.g., welcome screen, about dialog) + * Automatically adapts to theme + */ + @JvmField + val Logo: Icon = IconLoader.getIcon("/icons/slint-logo-full-light.svg", SlintIcons::class.java) } diff --git a/src/main/resources/icons/slint-logo-full-dark.svg b/src/main/resources/icons/slint-logo-full-dark.svg new file mode 100644 index 0000000..f745c44 --- /dev/null +++ b/src/main/resources/icons/slint-logo-full-dark.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/main/resources/icons/slint-logo-full-light.svg b/src/main/resources/icons/slint-logo-full-light.svg new file mode 100644 index 0000000..67afe7c --- /dev/null +++ b/src/main/resources/icons/slint-logo-full-light.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/main/resources/icons/slint-logo-square-dark.svg b/src/main/resources/icons/slint-logo-square-dark.svg new file mode 100644 index 0000000..08fd512 --- /dev/null +++ b/src/main/resources/icons/slint-logo-square-dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/icons/slint-logo-square-light.svg b/src/main/resources/icons/slint-logo-square-light.svg new file mode 100644 index 0000000..1c265c4 --- /dev/null +++ b/src/main/resources/icons/slint-logo-square-light.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/icons/slintFile.svg b/src/main/resources/icons/slintFile.svg new file mode 100644 index 0000000..1c265c4 --- /dev/null +++ b/src/main/resources/icons/slintFile.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/icons/slintFile_dark.svg b/src/main/resources/icons/slintFile_dark.svg new file mode 100644 index 0000000..08fd512 --- /dev/null +++ b/src/main/resources/icons/slintFile_dark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + +