Bug 1226207

Summary: breeze-dark (kf6-breeze-icons) symbolic icons aren't recolored and dark though should be light
Product: [openSUSE] openSUSE Tumbleweed Reporter: Mykola Krachkovsky <w01dnick>
Component: KDE Workspace (Plasma)Assignee: E-Mail List <opensuse-kde-bugs>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: alanemmanuel5, fvogt
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Mykola Krachkovsky 2024-06-12 08:07:23 UTC
kf6-breeze-icons generate identical icons for both breeze & breeze-dark. While this is not an issue for KF6 apps, that use run-time recoloring, in KF5 apps, like Krusader, when dark color theme is used and icons are breeze-dark symbolic icons are dark on dark background and almost invisible.

The reason is this build option: `-DWITH_ICON_GENERATION:BOOL=FALSE`

I've tried to make my custom build [1] switching it to TRUE and breeze-dark icons are fine with Krusader now. But I don't know the reasoning behind switching it to FALSE. There is comment:
```
saves ~30MB and installs dangling symlinks
```

Less size is true, though IMHO it's not a good solution to break KF5 apps to save some space.
But I can't see any dangling symlinks:
```
find /usr/share/icons/breeze{,-dark} -xtype l
```
doesn't find anything.

Any other reason or should I cleanup [1] and make a submit request?

[1] https://build.opensuse.org/package/show/home:NickLion:branches:KDE:Frameworks/kf6-breeze-icons
Comment 1 Fabian Vogt 2024-06-12 08:30:56 UTC
How's the size increase?

Maybe we could enable generation of dark symbolic icons but skip the 24px generation?
Comment 2 Mykola Krachkovsky 2024-06-12 08:48:53 UTC
(In reply to Fabian Vogt from comment #1)
> How's the size increase?

Without generation (as of current)
```
du -hs /usr/share/icons/breeze /usr/share/icons/breeze-dark
63M     /usr/share/icons/breeze
34M     /usr/share/icons/breeze-dark
```

With generation
```
du -hs /usr/share/icons/breeze /usr/share/icons/breeze-dark
72M     /usr/share/icons/breeze
59M     /usr/share/icons/breeze-dark
```

So about 34M.

> Maybe we could enable generation of dark symbolic icons but skip the 24px
> generation?

From CMake they are controlled by one option:
```
add_feature_info("Icon generation" ${WITH_ICON_GENERATION} "for 24x24 and symbolic dark icons.
   This feature requires Python 3 and the lxml Python 3 module."
) # The exact amount of indentation used in the line(s) above is intentional
```

But they made by different calls, so with some patching I think it could be done.
```
if(WITH_ICON_GENERATION)
    # No trainling slashes on dirs. It will break scripts.
    add_custom_target(breeze-generate-symbolic-dark ALL
        COMMENT "Generating symbolic dark icons"
        COMMAND $<TARGET_FILE:generate-symbolic-dark> ${CMAKE_SOURCE_DIR}/icons ${ICON_GEN_DIR}
    )
    # Auto-generate 24px monochrome icons from 22px versions
    add_custom_target(breeze-generate-24px-versions-dark ALL
        DEPENDS breeze-generate-symbolic-dark
        COMMENT "Generating 24px icons-dark"
        COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/generate-24px-versions.py
                ${CMAKE_CURRENT_SOURCE_DIR} ${ICON_GEN_DIR}
                ${ICON_GEN_DIR}
    )
else()
    # create the target dir, we need it for resource creation
    add_custom_target(breeze-generate-24px-versions-dark ALL
        COMMENT "Generating 24px icons-dark placeholder"
        COMMAND ${CMAKE_COMMAND} -E make_directory ${ICON_GEN_DIR}
    )
endif()
```
Comment 3 Christophe Marin 2024-06-12 09:21:06 UTC
(In reply to Fabian Vogt from comment #1)
> How's the size increase?
> 
> Maybe we could enable generation of dark symbolic icons but skip the 24px
> generation?

~ 20M if we drop the 24 icons folders after install.

The option seems to have another effect: a lot of other svg files are also modified with very small color changes and some CR are removed
Comment 4 Mykola Krachkovsky 2024-06-12 10:09:56 UTC
(In reply to Christophe Marin from comment #3)
> The option seems to have another effect: a lot of other svg files are also
> modified with very small color changes and some CR are removed

True. It seems `generate-symbolic-dark.cpp` doesn't check if change is really needed and a lot of not current-color symbolic icons (e.g. `places/22/folder-android.svg`) have unused ColorScheme-Text style. Maybe add detection of usage to that script? Check for something like `class="ColorScheme-Text"`/`class="ColorScheme-Background"` (I don't see any class attributes with more than one class) and if none found, skip file?
Comment 5 Mykola Krachkovsky 2024-06-12 11:54:39 UTC
(In reply to Mykola Krachkovsky from comment #4)
> Check for something like
> `class="ColorScheme-Text"`/`class="ColorScheme-Background"` (I don't see any
> class attributes with more than one class) and if none found, skip file?

Tried, but that's still not enough. There also should be a style fill:currentColor or that style does nothing so extra changes still applied. I'll think about it more.
Comment 6 Mykola Krachkovsky 2024-06-12 15:05:06 UTC
With this checks added [1], it's down to ~14M:
```
du -hs /usr/share/icons/breeze{,-dark}
63M     /usr/share/icons/breeze
48M     /usr/share/icons/breeze-dark
```

[1] https://build.opensuse.org/projects/home:NickLion:branches:KDE:Frameworks/packages/kf6-breeze-icons/files/kf6-breeze-icons-skip-unused.patch?expand=1
Comment 7 Mykola Krachkovsky 2024-06-13 17:20:03 UTC
With more skips:
1. Ignore all big applets icons — used by Plasma, not really used anywhere else.
2. Skip SVG's which use currentColor but also have explicitly set color style (class has no effect).

Size is reduced to 12M (as of used space) or 3.1M as file size:
```
du -hs breeze-icons-dark
12M     breeze-icons-dark

du -hs --apparent-size breeze-icons-dark
3,1M    breeze-icons-dark
```

I don't think it could be reduced noticeably anymore.

Getting rid of folders with some icons over them (original versions are perfectly fine as they are placed over folder color, not dark background) could possibly save another 1.5M of disk usage or roughly 0.5M of file size:
```
du -hs breeze-icons-dark
11M     breeze-icons-dark

du -hs --apparent-size breeze-icons-dark
2,6M    breeze-icons-dark
```

But I haven't found nice condition that doesn't affects symbolic icons.
Comment 8 hui 2024-07-21 11:14:22 UTC
*** Bug 1228168 has been marked as a duplicate of this bug. ***