FlorianWoelki / obsidian-iconize

Simply add icons to anything you want in Obsidian.
https://florianwoelki.github.io/obsidian-iconize/
MIT License
852 stars 58 forks source link

Custom icons for Properties #274

Open Ulhar opened 11 months ago

Ulhar commented 11 months ago

Is your feature request related to a problem? Please describe. Obsidian by default doesn't offer much customization for Properties outside of name, and the icons are determined solely by data type

Describe the solution you'd like Ideally, in Properties view, right-clicking a custom Property would let you choose a custom icon to accompany it, and that icon will replace the default icon based on its type (e.g. if you have a List property, instead of the List icon, you could change it to a different one)

Describe alternatives you've considered I have tried using a CSS snippet to override the icons, but this only works in the Properties editor that shows at the top of a note, not in the sidebar (CSS selectors can't filter by element content, and that's the only way the property names are exposed)

Additional context Results of aforementioned CSS snippet: Properties view on a note, with a 'characters' property showing a multi-user icon instead of the normal list icon (it's a rather messy snippet, using SVG inlining to replace the icon, and I don't think it would hold up at scale; I mostly offer this as an example use case)

ngsilverman commented 8 months ago

I just opened a PR (https://github.com/FlorianWoelki/obsidian-iconize/pull/353) which makes it possible to associate file properties with specific icons using custom rules. So the solution is a little different from what you proposed, rather than right-clicking a property, you would go to the Iconize plugin settings and add a custom rule.

For example, if you wanted a particular icon for all files that have a characters property you would simply write:

this.characters
Ulhar commented 8 months ago

Oh, I was actually thinking about properties themselves having custom icons, similar to how the tags property has a dedicated icon :sweat_smile: Sorry about any confusion there