Custom Icons for dark color mode

hi,

i would like to adapt my custom icons depending on dark/light mode
afaik icons does not support different color versions for this purpose, and all is managed directly by app.

so my first idea would be to change it with daily smart rule, there is a best way?
linked to this can i check by script the current color mode?
Thanks

I’m still on Mojave so don’t know whether that works in Catalina and above

-- Check whether macOS uses Dark Mode
-- Note: Don't know whether that works in Catalina and above

set isInDarkMode to false

try
	do shell script "defaults read -g AppleInterfaceStyle"
	set isInDarkMode to true
end try

return isInDarkMode

I know one can find out whether a record has a thumbnail with this

-- Find out whether a record has a thumbnail

tell application id "DNtp"
	try
		set theRecords to selected records
		if theRecords = {} then error "Nothing selected"
		set theRecord to item 1 of theRecords
		
		try
			thumbnail of theRecord as anything
			set hasThumbnail to true
		on error
			set hasThumbnail to false
		end try
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell

But how do you want to find out who set the thumbnail?

As far as I know it’s not possible to determine who set it (i.e. the user or DEVONthink or a file already had a thumbnail when it was imported).

If that’s true and we can’t tell who set a thumbnail then changing records that got a thumbnail would change all records with a thumnail.

Or do you use custom meta data or the like for this?

defaults read -g AppleInterfaceStyle

This approach does not work on Catalina and later.

thanks pete, the icon are setted by smart rules, as visual help, related on metadata content.
my question was about a viable way, to have specific icon for light/dark mode.

I colorize records too and it’s a big help. However I run a script manually when needed, might (additionally) be something for you too, see Script: Colorize DEVONthink Icons (Color Code Magick)

i was aware of your work (very smart) but not exactly what i searching for.
with this trend of dark mode i thought that should have been a simple way to swap icons, the same way .icns adapt their size.
i’ve not experience with new apple custom icons guidelines, maybe i’m wrong, but seems to me that only inside app i can define and show custom icons depending on interface style?

i tryed to create custom pdf icons with alpha layer, to experiment with blend modes, but mac os x engine seems always to add a white background to it, only bitmap png icons seems retain tranparency.