Dynamic Custom Menu Bar Icons

Is it possible to have custom menubar items display an icon based on the result of an AppleScript or terminal command? For example, an icon when dark mode is on, and another icon when dark mode is off?

If not, is it possible with floating menus, and how could this be done?

That's possible, have a look here:

thanks, ive got it working