php – Header Link to Activate Dark Mode for WordPress

I have an enqueued js file that contains the following:

function nightMode() {
    if (localStorage.getItem('stylesheet')) {
        localStorage.clear();
        document.getElementById('night-css').setAttribute('href', '');
    } else {
        localStorage.setItem('stylesheet', '/wp-content/themes/new/css/night.css');
        document.getElementById('night-css').setAttribute('href', localStorage.getItem('stylesheet'));
    }
}

document.getElementById('night-mode').addEventListener('click', nightMode)

I then have a link in my header.php file which looks like this:

<a id="night-mode">Night</a>

I also have, in my header file, a script which looks like this:

<script>

    (function(){
    
        var link = document.createElement('link');
    
        link.setAttribute('id', 'night-css');
    
        link.setAttribute('rel', 'stylesheet');
    
        document.head.appendChild(link);
    
        var style=localStorage.getItem('stylesheet');
    
        if(style) {document.getElementById('night-css').setAttribute('href',style);
    }
}
    )
()
</script>

But nothing happens when I click the link. No change, no error – nothing. Is something wrong here or??

Yes, the night css file exist and yes, it is located in the correct directory.

I have a photo taken with a cell phone in the dark the subject is unrecognizable how do i edit this to see what was in the photo?

The photo was taken with a cell phone in the dark.. the subject is unrecognizable when I start adding brightness contrast and highlights it makes it too pixily and even more confusing! What order would I start applying the adjustments? I dont want a great photo I just want to know what is in it? Is this possible? The background is black and the subject a grey color

Windows – Dark theme messed up

After enabling dark mode on Windows the file explorer still has some stuff showing white. And now the text is also white so I can’t see anything. Same thing happens in the context menu that drops down if I click on the window title bar. (The context menu inside the window is ok). Any ideas on how to fix this?

enter image description here

web app – Why red and blue boxes in close proximity seems to shift position vertically under a dark background

At first I thought this was going to be a ‘contrast ratio’ or ‘colour difference’ effect from the 1 pixel darker borders (or maybe it’s just aliasing) around each button. But the coloured border effect is a constant colour all the way round, and the red button looks lower at the top and the bottom when compared to the blue.

So I suggest this is an effect called Chromostereopsis. It is usually observed using a target with red and blue bars and an achromatic background – exactly as you have here. You can perceive a positive or negative chromostereopsis when the red bars are perceived in front of the blue or vice versa, explaining why some people might see the red button higher or lower than the blue.

The visual effect may be a result of chromatic aberration resulting from “the differential refraction of light depending on its wavelength, causing some light rays to converge before others in the eye”. But you can read plenty more about it below, rather than me pasting chunks of the internet! 🙂

Ref: https://en.wikipedia.org/wiki/Chromostereopsis

Are there solutions to dark patterns?

One could argue that ‘dark’ patterns are not necessarily bad in itself, because often they are just designed and/or implemented without validating whether it is fit for purpose. Other times there is a malicious or harmful intent not clearly communicated to the user, and again the patterns are not the issue here because in other contexts they would be perfectly suitable.

In both instances, education on the part of designers and developers is the key here. It is the root cause of the problem that most designers and developers are not trained or equipped to deal with ethical problems, and the managers also don’t have the tools required to manage this at their level. Most importantly, the company vision and culture needs to be authentic in its goal to try and help the users rather than seek profit.

There’s no quick and easy fix to this, but there are steps we can start to take towards addressing this. There are other questions with the design ethics tag that you might also want to have a look.

lightroom – Detecting very dark and very bright images in collection

I have established a vast photo collection over the past years. I did not always thoroughly delete bad shots before putting them onto my drive. I am looking for an approach (software, script, filters) to detect highly overexposed (virtually white) und underexposed (virtually black) pictures in my collection. I have not found anything useful so far apart from a discussion here:
https://community.adobe.com/t5/bridge/sort-bright-photos-from-dark-photos-in-bridge/td-p/9240332?page=1
However, it seems that the proposed script there does not work with newer versions of Photoshop.

Universal browser based Dark Mode (Dark Reader) vs. Individual separate black themes on each site

I’m pondering an idea about browser based, concentrated dark mode/dark theme service’s that operate pretty much like current superb add-on Dark Reader.

What makes me wonder why does the community that usually optimizes for not repeating work among developers, does take the burden of developing a dark theme for pretty much every popular web application.

Wouldn’t it be wiser to develop a set of standards when it comes to colour management, maybe even a .darktheme config file to override some of the basic settings, alongside a single browser based dark mode program for every browser that operates on the principle of current dark reader? I mean the reader is so good that I pretty much prefer it to custom made dark modes on most of the sites anyway.

What’s your insight on this matter?

My personal opinion is that it’s the inevitable future, but I haven’t found any signs that the process has started yet.

EDIT- before someone suggests sticking to the Dark Reader extension, It’s all good but compare a little a bit clunky extension developed by few enthusiasts to fully fledged browser options backed by hundreds of full-time developers.

Thanks!

dnd 3.5e – Does a dark tiefling need to eat?

No.

Normal tieflings are outsiders native to the material plane, that’s why they have the native subtype.

But a dark tiefling (that is, one with the dark creature template from the Tome of Magic) is native to the plane of shadow.

Tome of Magic, about dark creatures, p.158

Other creatures native to the Plane of Shadow exist that have stronger or weaker connections to the energies of the place (such as the shadow mastiff) and do not follow this template.

This means they lose the native subtype when acquiring the template, as they’re no longer native to the material plane. And indeed they gain the extraplanar subtype when outside the plane of shadow, like any other creature that’s outside their native plane.

So, as written, dark tieflings don’t need to eat or sleep since they’re normal outsiders.

Are there solutions for Dark Pattern?

From the dark-patterns description (emphasis added):

A design pattern which is carefully crafted to accomplish some result but does not have the user’s interests in mind.

In other words, a dark pattern is an aspect of a user’s experience in which they are intentionally taken advantage of; the site/developers are not designing an experience best suited to meet their customers’ needs. Instead, they have contrived one in which their own wants (or stakeholders’ desires) take priority.

Dark patterns can emerge through a number of ways. A non-exhaustive list of strategies includes:

  • lack of transparency to the user as to what the status of the system is
  • confusing wording or interfaces
  • hiding options or settings out of plain view
  • preselecting options that the user may not want
  • presenting upgrade paths as if they are necessary for basic functionality
  • making it particularly difficult to cancel a service

The solution to avoiding dark patterns, naturally, is to simply not design in a way that attempts to usurp users of their power of choice.

A Hacker From "The Dark Overlord" Was Arrested For Bitcoin Ransom

A hacker named Nathan Wyatt pleaded guilty in US courts saying that he was a member of the notorious hacker group "The Dark Overlord". The group was involved in stealing sensitive information from major companies and hospitals and then asking for huge amounts of bitcoin from the victims. The group also hacked Netflix in 2017. Wyatt will spend the rest of his life in prison for 5 years.