Skip to main content
Inspiring
April 16, 2023
Answered

Changing interface color for nightshift

  • April 16, 2023
  • 4 replies
  • 2094 views

Is it possible to use white background during the day, and dark grey at night when the sun is down?

I've set up my Mac to do just that, but unlike Mac apps, Photoshop refuse to go along.

Thanks,

-Ronald

 

This topic has been closed for replies.
Correct answer Stephen Marsh

@SSL-ADT 

 

One can of course manually change this in Preferences > Interface...

 

An action or a script can help to automate this. The following conditional script will change the UI to the dark theme between 6pm and 6am (based on your computer clock), otherwise, it will use the original/white theme:

 

/*
Night Shift Interface Colour Theme Change.jsx
v1.0 - 17th April 2023, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/changing-interface-color-for-nightshift/td-p/13729086
*/

#target photoshop

var theTime = new Date().toLocaleTimeString().replace(/(\d{2})(.+)/, "$1");
theTime = Number(theTime);

// Dark between 6pm and 6am
if (theTime >= 18 || theTime < 6) {
    setUIcol("kPanelBrightnessDarkGray");
} else {
    setUIcol("kPanelBrightnessOriginal");
}

function setUIcol(uiCol) {
	// "kPanelBrightnessOriginal" | "kPanelBrightnessLightGray" | "kPanelBrightnessMediumGray" | "kPanelBrightnessDarkGray"
	function s2t(s) {
		return app.stringIDToTypeID(s);
	}
	var descriptor = new ActionDescriptor();
	var descriptor2 = new ActionDescriptor();
	var reference = new ActionReference();
	reference.putProperty( s2t( "property" ), s2t( "interfacePrefs" ));
	reference.putEnumerated( s2t( "application" ), s2t( "ordinal" ), s2t( "targetEnum" ));
	descriptor.putReference( s2t( "null" ), reference );
	descriptor2.putEnumerated( s2t( "kuiBrightnessLevel" ), s2t( "uiBrightnessLevelEnumType" ), s2t( uiCol ));
	descriptor.putObject( s2t( "to" ), s2t( "interfacePrefs" ), descriptor2 );
	executeAction( s2t( "set" ), descriptor, DialogModes.NO );
}

 

Instead of manually running the script, it can be set to run automatically via the Script Events Manager:

 

https://prepression.blogspot.com/2021/10/photoshop-script-events-manager.html

 

It would just be a case of setting one or more events to trigger the script.

 

4 replies

Participant
July 26, 2023
  1.  
D Fosse
Community Expert
Community Expert
April 17, 2023

I know this isn't the question you asked, but it might be worth considering.

 

If the aim is to maintain consistent output, it actually makes more sense to do it the other way round.

 

The darker the environment is, the brighter your image appears, and as a consequence you'll edit it darker. Both ambient light and application interface contribute. If the ambient light level is low, darkening the app interface will amplify the effect.

 

The eye needs a reference to adapt to, so in that case it's better to have a bright interface, and check periodically against a pure white backdrop.

 

If you can't maintain consistent ambient light - and in practice that's often not possible - the best way to compensate is to change your calibration targets for brightness (and possibly also white point color). In other words, the whole monitor is dimmer at night. The visual reference for white should still be paper white.

 

Note that this means changing both calibration target and corresponding monitor profile. Some calibrators will easily let you switch just by clicking a different target, others don't. Realistically, you can't be expected to rerun you calibrator twice a day - so in that case, keep a bright app interface, and check against a white backdrop.

 

It might also be prudent to not trust edits done at night. Work away, but hold final judgement until the next day.

SSL-ADTAuthor
Inspiring
April 24, 2023

Not sure what backdrop you are referring to. 

Conrad_C
Community Expert
Community Expert
April 17, 2023

Background info: Stephen’s script, or a tool like it, is necessary because Photoshop is only partially adapted for macOS day/night mode. Earlier versions of Photoshop did not support it at all, then in a recent version Photoshop added support for it in some UI items. For example, today Photoshop menus and dialog box title bars do follow macOS day/night mode. But the overall color theme, found in Preferences > Interface, does not currently follow macOS day/night mode and that is why it needs to be scripted.

SSL-ADTAuthor
Inspiring
April 17, 2023

In that case, I will wait until it is fully implemented. The sunset time is never the same up north. 

Is MacOS better for photoshop than Windows? I'm new to MacOS, and highly disappointed in the handline of scaled resolutions.

 

SSL-ADTAuthor
Inspiring
April 17, 2023

I meant "handling"

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
April 17, 2023

@SSL-ADT 

 

One can of course manually change this in Preferences > Interface...

 

An action or a script can help to automate this. The following conditional script will change the UI to the dark theme between 6pm and 6am (based on your computer clock), otherwise, it will use the original/white theme:

 

/*
Night Shift Interface Colour Theme Change.jsx
v1.0 - 17th April 2023, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/changing-interface-color-for-nightshift/td-p/13729086
*/

#target photoshop

var theTime = new Date().toLocaleTimeString().replace(/(\d{2})(.+)/, "$1");
theTime = Number(theTime);

// Dark between 6pm and 6am
if (theTime >= 18 || theTime < 6) {
    setUIcol("kPanelBrightnessDarkGray");
} else {
    setUIcol("kPanelBrightnessOriginal");
}

function setUIcol(uiCol) {
	// "kPanelBrightnessOriginal" | "kPanelBrightnessLightGray" | "kPanelBrightnessMediumGray" | "kPanelBrightnessDarkGray"
	function s2t(s) {
		return app.stringIDToTypeID(s);
	}
	var descriptor = new ActionDescriptor();
	var descriptor2 = new ActionDescriptor();
	var reference = new ActionReference();
	reference.putProperty( s2t( "property" ), s2t( "interfacePrefs" ));
	reference.putEnumerated( s2t( "application" ), s2t( "ordinal" ), s2t( "targetEnum" ));
	descriptor.putReference( s2t( "null" ), reference );
	descriptor2.putEnumerated( s2t( "kuiBrightnessLevel" ), s2t( "uiBrightnessLevelEnumType" ), s2t( uiCol ));
	descriptor.putObject( s2t( "to" ), s2t( "interfacePrefs" ), descriptor2 );
	executeAction( s2t( "set" ), descriptor, DialogModes.NO );
}

 

Instead of manually running the script, it can be set to run automatically via the Script Events Manager:

 

https://prepression.blogspot.com/2021/10/photoshop-script-events-manager.html

 

It would just be a case of setting one or more events to trigger the script.

 

Stephen Marsh
Community Expert
Community Expert
April 17, 2023

It may also be possible to run the script at the operating system level at a specific time, however, that would depend on the scheduling features of the OS (I haven't looked at this yet).