getMetaThemeColor method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(note: 'This method is implemented using JavaScript.'), IOSPlatform(apiName: 'WKWebView.themeColor', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor', note: 'On iOS < 15.0, this method is implemented using JavaScript.'), LinuxPlatform(apiName: 'webkit_web_view_get_theme_color', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.get_theme_color.html'), MacOSPlatform(apiName: 'WKWebView.themeColor', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor', note: 'On iOS < 12.0, this method is implemented using JavaScript.'), WebPlatform(note: 'This method is implemented using JavaScript.'), WindowsPlatform(note: 'This method is implemented using JavaScript.')])
Returns an instance of Color representing the content value of the
<meta name="theme-color" content=""> tag of the current WebView, if available, otherwise null.
Officially Supported Platforms/Implementations:
- Android WebView:
- This method is implemented using JavaScript.
- iOS WKWebView (Official API - WKWebView.themeColor):
- On iOS < 15.0, this method is implemented using JavaScript.
- Linux WPE WebKit (Official API - webkit_web_view_get_theme_color)
- macOS WKWebView (Official API - WKWebView.themeColor):
- On iOS < 12.0, this method is implemented using JavaScript.
- Web <iframe> but requires same origin:
- This method is implemented using JavaScript.
- Windows WebView2:
- This method is implemented using JavaScript.
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(note: 'This method is implemented using JavaScript.'),
IOSPlatform(
apiName: 'WKWebView.themeColor',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor',
note: 'On iOS < 15.0, this method is implemented using JavaScript.',
),
LinuxPlatform(
apiName: 'webkit_web_view_get_theme_color',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebView.get_theme_color.html',
),
MacOSPlatform(
apiName: 'WKWebView.themeColor',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebview/3794258-themecolor',
note: 'On iOS < 12.0, this method is implemented using JavaScript.',
),
WebPlatform(note: 'This method is implemented using JavaScript.'),
WindowsPlatform(note: 'This method is implemented using JavaScript.'),
],
)
Future<Color?> getMetaThemeColor() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.getMetaThemeColor.name} is not implemented on the current platform',
);
}