Tags down


NSPopover + NSBox in dark mode tint/gamma issue

By : Miguel Iglesias
Date : October 16 2020, 06:10 PM
hop of those help? Solved by adding extra NSVisualEffectView behind the NSBox where blending is set to happen within window. left(with visual effect view), right (without).
code :

Share : facebook icon twitter icon

NSStatusItem change image for dark tint

By : Raymond Chua Sing
Date : March 29 2020, 07:55 AM
To fix the issue you can do TL;DR: You don't have to do anything special in Dark Theme. Give NSStatusItem (or NSStatusBarButton) a template image and it will style it correctly in any menubar context.
code :
_statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
NSImage *image = [NSImage imageNamed:@"statusItemIcon"];
[image setTemplate:YES];
[_statusItem setImage:image];
@property (readonly, strong) NSStatusBarButton *button NS_AVAILABLE_MAC(10_10);

NV21 to Bitmap on Android, Very dark image, grayscale, or yellow tint?

By : coalesce
Date : March 29 2020, 07:55 AM
it fixes the issue If you are trying to convert YUV from camera to Bitmap, here is something you can try:
code :
// import android.renderscript.*
// RenderScript mRS;
// ScriptIntrinsicYuvToRGB mYuvToRGB;
// Allocation yuvPreviewAlloc;
// Allocation rgbOutputAlloc;

// Create RenderScript context, ScriptIntrinsicYuvToRGB and Allocations and keep reusing them.
if (NotInitialized) {
    mRS = RenderScript.create(this).
    mYuvToRGB = ScriptIntrinsicYuvToRGB.create(mRS, Element.YUV(mRS));    

    // Create a RS Allocation to hold NV21 data.
    Type.Builder tYuv = new Type.Builder(mRS, Element.YUV(mRS));
    yuvPreviewAlloc = Allocation.createTyped(mRS, tYuv.create(), Allocation.USAGE_SCRIPT | Allocation.USAGE_IO_INPUT);

    // Create a RS Allocation to hold RGBA data.
    Type.Builder tRgb = new Type.Builder(mRS, Element.RGBA_8888(mRS));
    rgbOutputAlloc = Allocation.createTyped(mRS, tRgb.create(), Allocation.USAGE_SCRIPT);

    // Set input of ScriptIntrinsicYuvToRGB

// Use rsPreviewSurface as one of the output surface from Camera API.
// You can refer to https://github.com/googlesamples/android-HdrViewfinder/blob/master/Application/src/main/java/com/example/android/hdrviewfinder/HdrViewfinderActivity.java#L504
Surface rsPreviewSurface = yuvPreviewAlloc.getSurface();

// Whenever a new frame is available
// Update the yuv Allocation with a new Camera buffer without any copy.
// You can refer to https://github.com/googlesamples/android-HdrViewfinder/blob/master/Application/src/main/java/com/example/android/hdrviewfinder/ViewfinderProcessor.java#L109
// The actual Yuv to Rgb conversion.

// Copy the rgb Allocation to a Bitmap.

// continue processing mBitmap.

How to activate the dark mode in react native app when android theme set to dark mode?

By : user3287331
Date : March 29 2020, 07:55 AM
To fix the issue you can do You can use react-native-appearance:
code :
import { AppearanceProvider, Appearance } from 'react-native-appearance';

export default () => (
    <App />

let colorScheme = Appearance.getColorScheme();

let subscription = Appearance.addChangeListener(({ colorScheme }) => {
  // do something with color scheme

NSPopover Background Color (Including Triangle) with macOS Mojave Dark Mode

Date : March 29 2020, 07:55 AM
I wish did fix the issue. It's funny how writing up your question leads to a solution (sometimes quickly). I realized I needed to create another NSView subclass responsible for generating the NSView that's loaded into the NSPopover. Note the addition of the PopoverMainView class:
code :
class PopoverMain:NSView{
  override func viewDidMoveToWindow() {
    guard let frameView = window?.contentView?.superview else { return }

    let backgroundView = PopoverMainView(frame: frameView.bounds)
    backgroundView.autoresizingMask = [.width, .height]
    frameView.addSubview(backgroundView, positioned: .below, relativeTo: frameView)

class PopoverMainView:NSView {
  override func draw(_ dirtyRect: NSRect) {
    Color(named: "MyColor")!.set()

Issue with Saving Dark Mode Preference (localStorage)

By : Jacob London
Date : March 29 2020, 07:55 AM
Does that help I am trying to use localStorage to save the dark mode preference on my website. The issue I am running into is when you switch to dark mode and hit refresh, it stays in dark mode. However, if you switch to dark mode, then back to light mode, and hit refresh, it loads dark mode. , You need to set a Boolean to localStorage:
code :
let darkThemeEnabled = $("section").hasClass("dark");
localStorage.setItem("dark-theme-enabled", darkThemeEnabled);
if (localStorage.getItem('dark-theme-enabled')) {
Related Posts Related Posts :
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk