PDFKit's PDFView seems to not be compatible with dark mode. It's effectiveAppearance does not get updated when user switches to dark mode.
override public func updateLayer() {
print("mode = \(effectiveAppearance.name)")
super.updateLayer()
}
// even in dark mode, always prints: mode = NSAppearanceName(_rawValue: NSAppearanceNameAqua)
Is there any reason for that? Any elegant workaround to change PDFView's background color with dark mode?
Related
I want to have a white status bar with black font in my white theme. the problem is that the styleDefault() method which is made for it does not work. But this error only happens on Android on Ios it works perfectly. Is there any way to change the font color to black on the statusbar (only for android) or to change it with css? Or how can i make styleDefault() (dark text, for light backgrounds) work again?
Here is my code:
private setStatusBarStyle(darkTheme: boolean) {
if (darkTheme) {
this.statusBar.styleLightContent();
} else {
this.statusBar.styleDefault();
}
}
I am working to an application with unity3D and MRTK package for hololens2 and I am trying to change the color of a toggle when it is disabled.
The toggle has an Interactable script on it with many profiles, one of them has two themes for the selected state that are "InteractableActivateTheme" and "Interactable color children theme".
I used successfully the latter to change color of the toggle when selected using the theme field "Pressed" and "Default", but I am not able to use the "Disabled" field in any case.
Screenshot of the profile I am talking about
I disable the toggle by code setting the state to disabled in this way:
PlaceToggle.SetState(InteractableStates.InteractableStateEnum.Disabled, true);
PlaceToggle.enabled = true;
The toggle disables itself but the color remains red has set in the "Default" State Properties of the "InteractableColorChildrenTheme".
I also tried to change the color by code like this, but I had no result:
var activeThemes = PlaceToggle.ActiveThemes;
foreach (InteractableThemeBase itb in activeThemes)
{
if (itb is InteractableColorChildrenTheme)
{
Debug.Log(" changing state property");
var property = itb.StateProperties;
oldColor = itb.StateProperties[0].Values[0].Color;
itb.StateProperties[0].Values[0].Color = Color.gray;
}
}
Any idea on how could I understand what it is happening and why it is not working??
Thanks you all
Please try the following code to disable your button:
buttonInteractable = this.GetComponent<Interactable>();
buttonInteractable.IsEnabled = false;
Verified in MRTK2.7 & Unity 2019.4.22.
Currently i have enabled dark mode in my iphone.
but UITraitCollection.current.userInterfaceStyle always returns current mode as "Unspecified".
I want to get the device/system/os mode that is currently selected.
if UITraitCollection.current.userInterfaceStyle == .dark {
print("Yes dark mode")
} else {
print("Not dark mode")
}```
I have a react app with Material UI. I know how to set the theme's default background color on body. However, I want to set a background image instead. How can I accomplish this?
const theme = createMuiTheme({
palette: {
background: {
default: ???
}
}
});
If you are using CssBaseline you can apply a global style through theme overrides and set the backgroundImage for body e.g. https://codesandbox.io/s/v30yq681ql. You should be able to set the global style through any component that you are using.
If someone has experience with WKWebView, please share how to make the background of the view transparent. The WebView object has such option via var drawsBackground: Bool { get set } but it is missing for the WKWebView class. I searched the net and .. found nothing. Before time it was possible to do so via opaque property, but not anymore. There is a getter isOpaque ... and that's it. I don't want to do it via CSS and already tried everything else, like:
webview.wantsLayer = true
webview.layer?.backgroundColor = NSColor.clear.cgColor
If someone can help ...
I. Nikolov
This should work for both macOS 10.11 and macOS 10.12:
if NSAppKitVersion.current.rawValue > 1500 {
webView.setValue(false, forKey: "drawsBackground")
}
else {
webView.setValue(true, forKey: "drawsTransparentBackground")
}
Remark: this has been passed by App Store review.
Your web page should have transparent background as well.