Night time "Dark Mode"

Anything QL Software or Programming Related.
Post Reply
User avatar
NormanDunbar
Forum Moderator
Posts: 2278
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Night time "Dark Mode"

Post by NormanDunbar »

On another thread, viewtopic.php?p=52667#p52667:
Dilwyn wrote:I wish the QL had a "dark mode" for use at night, where it automatically gave everything red or black paper colour. Could probably be done as a small compiled task which sat there, checking the time, and at the appropriate time in the evening started interfering with BASIC channels, altering the paper and ink colours when it spots white or blue background, so your eyes get less blue and white in the runup to bedtime. Never tried it, no idea if it could work, but given the QL's limited colours it might be more annoying than useful. A possible programming challenge for someone, maybe?
I've had a think about this as I thought it might be something I could do for the next (exciting) Assembly eComic. Which is delayed as I currently have three books on the boiler! Anyway:

I'm not convinced it can be done properly. If I manage to write something that can scan the open channels to find scr_ and con_ channels, then rummage in their undergarments to find the paper and strip colours, and detect any that have blue, and decide to change colour to a different one with no/less blue, and then decide on a suitable ink colour to got with the new paper/strip colour, nothing will actually change until the task redraws its screen display.

Likewise, if we consider only channels using a palette, then we have the same problem again.

Now, someone prove me wrong! ;)

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Night time "Dark Mode"

Post by dilwyn »

Like you, the more I've thought about it, the less likely I think it to be viable.

After rummaging around in the software undergarments (as you put it), you'd then need to force a redraw, and there are so many different ways to handle that; for non-pointered software stuff an F4 or SHIFT F5 into the keyboard queue, or for pointered stuff a CF2 or force a 'wake' event, to force a redraw.

It might even need to go as far as either find the current window and PEEK & POKE old and new colours to match what you forced into the channels blocks. Or a brute force approach where you walk through the entire screen to change all colours to weed out or reduce blues, on the basis that anything you subsequently draw in active programs which have had their colours patched in the CDBs will be in the new less-blue colours anyway.

Messy. Very messy. And besides, on an emulator, the Dark Mode of the host OS will probably have done it for you anyway.


User avatar
janbredenbeek
Super Gold Card
Posts: 633
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: Night time "Dark Mode"

Post by janbredenbeek »

RECOL might do the job of recolouring what's already on the screen.

As for the rest, you have to find out which channels are con or scr by peeking CH.DRIVR, then find out if the PE is involved (because this adds 48 bytes of extra data at the bottom of the driver-specific part), and then find out what the colours are. This will be relatively easy with the classic QL palette (8 colour + stipple pattern, which fits into a byte), but what about the 16-bit colours from QPC or Q68? (even worse, both use different 16-bit colour codings!). Then change the colours to something sensible and hope that the program itself doesn't change them back when updating the windows...


Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Night time "Dark Mode"

Post by Derek_Stewart »

Hi,

Just a theme in SMSQ/E, by using Per's Theme package, see this thread:
viewtopic.php?t=2961


Regards,

Derek
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Night time "Dark Mode"

Post by dilwyn »

Derek_Stewart wrote: Wed Oct 11, 2023 9:47 pm Hi,

Just a theme in SMSQ/E, by using Per's Theme package, see this thread:
viewtopic.php?t=2961
Easy enough to create dark themes in themselves. I have a "black" theme in one of my theme packages on that page as well, created with Q-CoCo.
The real problem is changing the display of individual programs when it becomes time for the "dark mode" to cut in. Easy enough to write a timer which installs a given theme at a given time, but as Norman and Jan point out, it's what happens with individual programs already running once that theme cuts in.


swensont
Forum Moderator
Posts: 252
Joined: Tue Dec 06, 2011 3:30 am
Location: SF Bay Area
Contact:

Re: Night time "Dark Mode"

Post by swensont »

How about just turning down the brightness on the monitor? :-)
The QL Vision monitor had a nice knob for that.


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Night time "Dark Mode"

Post by dilwyn »

swensont wrote: Fri Oct 13, 2023 5:56 am How about just turning down the brightness on the monitor? :-)
The QL Vision monitor had a nice knob for that.
Californian sarcasm at work :D
Anyway, my monitor doesn't turn the knob automatically.


Post Reply