pcorless / icepdf

PDF Rendering and Viewing API in Java
Apache License 2.0
84 stars 21 forks source link

Allow for customization of icons used by provided Swing components #345

Closed a-leithner closed 6 months ago

a-leithner commented 8 months ago

I have recently implemented a PDF viewer in a Swing application with ICEPdf and it works great so far.

However, the style of the icons provided with ICEPdf don't at all fit the overall style of the application I'm using it in. I have thus found myself copying a bunch of classes from this project just to change the icons used for most of the tool buttons.

It would be great if ICEpdf could allow for customization of the lookup of icons, as well as the format of the filenames (e.g., I don't want to have separate rollover icons).

In principle, I'd be willing to contribute a PR though it's currently a little tough time-wise. (If you agree this would be useful and if I'm not overlooking something very basic.)

pcorless commented 8 months ago

Thanks for the feedback. As you noted there currently isn't an easy way to do a quick icon swap. I've been struggling myself in this department with some recent new toolbar additions. It's a lot of work to add new icon, rollover state makes it even worse.

The original icon set was created by a graphic designer and I've tried pretty hard to match the style a much as possible with new icons. I've wanted to create a new set for a long time that was a lot lower key, something more along the UI guide lines Gnome has produced. Another consideration is also a JavaFX which would allow for the use of SVG icons and CSS which in theory would simplify things.

I think it would be pretty easy to adjust for an icon set that doesn't have a rollover state and a better file name and directory scheme. When you have some time please submit a PR even if it's just a draft. I'd be interested in making the related changes and it's always nice get a bit of community feedback to help the process.

a-leithner commented 8 months ago

Sure! I'll see what I can come up with over the course of the next couple of weeks.

As of late, FlatLaF has provided support for SVG icons in Swing. Obviously, depending on a whole LaF is something I wouldn't recommend, but I wonder if there is some code we could integrate (or depend on, if they provide a separate package for it) to load and render SVG files.

Speaking of renewing the icon set (though being a completely different consideration), I have used Material Design Icons lately, though I imagine they're laking some of the icons "messages" needed for a full-blown PDF viewer. Also, there's always the possibility to use some of the other free icon themes shipping with Gnome (Adwaita, I think) or KDE (Breeze) which are surely more complete. Other projects (like LibreOffice) do this too.

I'd be focussing on getting Icons swappable for now though, preserving the current icons. But I'm open to do some of that rework in the future too, if you want.

Finally, thanks for all the effort you've put into creating and maintaining this project; it's been very great to find for aforementioned application!

pcorless commented 8 months ago

Cool, I'll keep an eye out for progress. In the mean time I'll see if I can compile a list of matching icons, I totally forgot about the material design icons.

a-leithner commented 8 months ago

I've come up with a system/API for customizable icons for the ICEpdf viewer in #347 – I hope that's somewhere along the lines of the kind of abstraction you're looking for here.