66//! We recommend using either [`Result::unwrap_or`] or [`Result::unwrap_or_default`] to do this.
77//!
88//! #### Platform Support
9- //! Theme is available for Web, Windows, & Mac. Linux is unsupported and Android/iOS has not been tested .
9+ //! Theme is available for Web, Windows, & Mac. Linux is unsupported and Android/iOS are not supported .
1010//!
1111//! # Examples
1212//! An example of using the theme to determine which class to use.
1717//! #[component]
1818//! fn App() -> Element {
1919//! let theme = use_system_theme();
20- //!
20+ //!
2121//! // Default to a light theme in the event of an error.
2222//! let class = match theme().unwrap_or(Theme::Light) {
2323//! Theme::Light => "bg-light",
@@ -166,7 +166,7 @@ fn listen(mut theme: Signal<ThemeResult>) {
166166
167167// The listener implementation for desktop targets. (not linux)
168168// This should only be called once.
169- #[ cfg( not( target_family = "wasm" ) ) ]
169+ #[ cfg( not( any ( target_family = "wasm" , target_os = "linux" ) ) ) ]
170170fn listen ( mut theme : Signal < ThemeResult > ) {
171171 use dioxus_desktop:: {
172172 WindowEvent ,
@@ -192,7 +192,7 @@ fn listen(mut theme: Signal<ThemeResult>) {
192192}
193193
194194// The listener implementation for unsupported targets.
195- #[ cfg( target_os = "linux" ) ]
195+ #[ cfg( any ( target_os = "linux" , target_os = "android" , target_os = "ios" ) ) ]
196196fn listen ( mut theme : Signal < ThemeResult > ) {
197197 theme. set ( Err ( ThemeError :: Unsupported ) ) ;
198198}
@@ -253,7 +253,7 @@ fn get_theme_platform() -> ThemeResult {
253253}
254254
255255// The desktop (except linux) implementation to get the system theme.
256- #[ cfg( not ( target_family = "wasm " ) ) ]
256+ #[ cfg( any ( target_os = "windows" , target_os = "macos ") ) ]
257257fn get_theme_platform ( ) -> ThemeResult {
258258 use dioxus_desktop:: DesktopContext ;
259259 use dioxus_desktop:: tao:: window:: Theme as TaoTheme ;
@@ -272,7 +272,7 @@ fn get_theme_platform() -> ThemeResult {
272272}
273273
274274// Implementation for unsupported platforms.
275- #[ cfg( not ( any( target_family = "wasm " , target_os = "windows " , target_os = "macos" ) ) ) ]
275+ #[ cfg( any( target_os = "linux " , target_os = "android " , target_os = "ios" ) ) ]
276276fn get_theme_platform ( ) -> ThemeResult {
277277 Err ( ThemeError :: Unsupported )
278278}
0 commit comments