How to render icon menu using SVG #12330
-
Currently we have option to use Native Icon (very limited) or our own icon using Or is there any option for us to differentiate the icon for dark and light theme? How do we detect the theme inside our rust code? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The system's don't support svg so it requires an svg renderer in the app. iirc those are fairly large so i doubt we'd add them into tauri directly but you can still use the resvg crate for example yourself. You can get the current window theme via https://docs.rs/tauri/2.0.0/tauri/window/struct.Window.html#method.theme but getting the OS theme directly requires some native apis (assuming there's a way to get thouse without the window). That said, if you don't use the window theme setter apis then this should be good enough i think. |
Beta Was this translation helpful? Give feedback.
The system's don't support svg so it requires an svg renderer in the app. iirc those are fairly large so i doubt we'd add them into tauri directly but you can still use the resvg crate for example yourself.
You can get the current window theme via https://docs.rs/tauri/2.0.0/tauri/window/struct.Window.html#method.theme but getting the OS theme directly requires some native apis (assuming there's a way to get thouse without the window). That said, if you don't use the window theme setter apis then this should be good enough i think.