Pegasus Mail & Mercury

Welcome to the Community for Pegasus Mail and
The Mercury Mail Transport System, the Internet's longest-serving PC e-mail system!
Welcome to Pegasus Mail & Mercury Sign in | Join | Help
Home Blogs Forums Downloads Pegasus Mail Overview Mercury Overview Wiki

Mail Editor - Users with non-white window background in Windows - how Pegasus currently handles it and suggestion

Last post 01-17-2020, 16:25 by archimedes1. 3 replies.
Sort Posts: Previous Next
  •  01-15-2020, 18:04

    Mail Editor - Users with non-white window background in Windows - how Pegasus currently handles it and suggestion

    Please see this thread and this screenshot:


    The system default window background colour is set in Windows Registry (or by colour setting apps).  In Windows, although the default is white (255 255 255 or #FFFFFF), it could of course be any colour.  Visually impaired people may change to a high contrast colour scheme.  People who use their PC a lot in the evening or night often prefer darker themes.  Some people just don't like a screen full of white.  There are good reasons for this, including reducing eye-strain.

    In Win10 the precise registry key is:

    [HKEY_CURRENT_USER\Control Panel\Colors]

    "Window"= for the background colour

    "WindowText" for the foreground colour.


    As explained in my above-linked post and screenshot, it looks like Pegasus' current approach is to notice the system background colour and automatically set the on-screen colour for certain screen elements to try to achieve high contrast.  So Pegasus has programmatically chosen the nasty pale brown brown text colour you are seeing in the screenshot posted.

    Specifically, in the New Mail editor, the default text colour on screen (i.e. the colour seen when no style is used to change the text colour) is done like this, and you can also see in the screenshot that this is the colour of the cursor at the end of the message.  This also applies to the colour of any unstyled text in a quoted message, for example when writing a mail in reply to an email.   Maybe this is also seen in other on-screen elements in Pegasus when no other colour is set, I have not checked everything.

    Pegasus is setting the on-screen text colour using the formula: (#FFFFFF - window background colour).

    It's a nice idea to take some control of text colours, in cases where the window background colour is not white.  But the implementation is poor.  Specifically, the closer the window background colour is to a mid-range colour like #808080, the weaker the contrast becomes when Pegasus uses this approach.  The weaker contrast increases eye-strain.

    In my case, ideally I would like to set a black background colour #000000 in Windows.  But that approach falls down in a lot of applications and websites, if the programmer has hard-coded a text colour (e.g. black) for a window, menu or other on-screen element, but allowed the application to use Windows system background colour.  Regrettably, that's very common.  Also, plenty of other applications have hard-coded colours for other on-screen elements assuming a white window background.  It's inconsiderate, especially to visually impaired people or people like me with old eyes.  But to avoid pain with all those applications, the best I can do in practice is choose a mid-range colour - it's not fully white, but it still gives high contrast in the majority of applications which want to present information and menu text in black, dark grey, or other dark colours.  Using a mid-range colour as the background in Windows, unfortunately gives rise to the contrast problem in Pegasus.


    My suggestion is that Pegasus should do one or more of the following four things:

    1.   Use the Windows system text colour, whenever displaying text on a background which is the Windows system background colour.  This works, because normally, anyone who has changed the Windows system background colour will also have changed the text colour to something which gives them enough contrast.   This is fairly conventional and my preferred approach.

    2.   Provide a setting for the user to choose the on-screen colour for text elements, instead of setting it programmatically.   (But I understand that adding any setting requires a lot of UI coding and redesign, and the more settings there are in the application, the more complex the application becomes for other users.)   

    3.   Provide a configuration option in PMAIL.INI which can control this behaviour and which can be edited manually by anyone who needs to.

    4.   Use a better algorithm for picking a high contrast colour, instead of (#FFFFFF - background).   As explained in the linked article above, for a first pass, black text looks best on any background which is brighter than #808080, white text looks best on any darker background.  For a more sophisticated second pass approach, instead of setting the cut-off at #808080 (and it's going to be hard to determine if a colour like #2080A0 is brighter or darker than that), you could calculate the luminance of the background colour.

    In my own work I use the following Java code to calculate relative luminance from a standard Windows colour value like #FFFFFF, i.e. an integer RGB colour.  It involves several steps as you have to convert to sRGB first.  You are welcome to use this code in PMail.


    public static double luminanceRelative(int c)


    float rgb[] = rgbToFloatArray(c);

    double sRGB[] = rgbToSRGB(rgb);

    return luminanceSRGB(sRGB);


    private static float[] rgbToFloatArray(int c)


    int g = c >> 8;

    int r = g >> 8;

    g = g & 0xff;

    int b = c & 0xff;

    float f[] = { r / 255F, g / 255F, b / 255F };

    return f;


    private static double[] rgbToSRGB(float[] rgb)


    double sRGB[] = new double[3];

    int i = 0;

    for (float f : rgb) {

    if (f > 0.03928F) sRGB[ i ] = Math.pow((f + 0.055) / 1.055, 2.4);

    else sRGB[ i ] = f / 12.92;



    return sRGB;


    private static double luminanceSRGB(double[] sRGB)


    return 0.2126 * sRGB[0] + 0.7152 * sRGB[1] + 0.0722 * sRGB[2];



  •  01-16-2020, 15:23

    Re: Mail Editor - Users with non-white window background in Windows - how Pegasus currently handles it and suggestion

    I understand your point. I'm also concerned about eye strain too but treat this application by application is not the best practice IMHO. I use f.lux for this. It takes care of the problem so greatly I even forget it's running. And better: it does it for ALL applications I'm using with refinements like taking the time of the day and your geographic position in account to correct your screen color along the day work. I recommend its use to all my customers and friends.


    euler f german
    sete lagoas, mg, brazil
    Pegasus Mail 4.73.639 Standalone - Windows 7 Ultimate
    BearHTML IERenderer
    Binaries: C:\PMAIL\Programs
    Mailboxes: C:\PMAIL\MAIL

    InsPMDic — Dictionary Handler Add-on (link on profile)
  •  01-16-2020, 22:00

    • Brian Fluet is not online. Last active: 05-31-2020, 20:41 Brian Fluet
    • Top 10 Contributor
    • Joined on 12-24-2014
    • North Carolina, USA
    • SuperStar
    • Points 31,040

    Re: Mail Editor - Users with non-white window background in Windows - how Pegasus currently handles it and suggestion

    I also struggle with stark white backgrounds and change as many as I can that are configurable within the app.  While researching f.lux I found references to a Night Light function on Win10 that I didn't know existed.  I now have it scheduled for work hours on my office PC (an 'always on' option would be nice).  I set the strength at 15 which I find to be just enough to take the blueness out of the white background, kind of like the difference between a warm white and a cool white light bulb. 
  •  01-17-2020, 16:25

    Re: Mail Editor - Users with non-white window background in Windows - how Pegasus currently handles it and suggestion

    Thank you both for the suggestions re. changing the colour tone of Windows 10 to reduce the amount of blue and lower the colour temperature.  I am already doing something similar. 


    * I have" target="_blank" title="">calibrated the monitor colours to have overall less blue, similar to Windows Night Light - carefully done to preserve relative colour accuracy, so photos and movies etc still look good.  This is similar to having f.lux or the Win10 Night Light enabled all the time.  I don't change it at different times of day.  Technologically this is also a good solution because colour calibration is done through the graphics card, so it automatically applies to everything (full screen movies, games, etc).  Specifically, Windows uploads the colour calibration profile to the graphics card when Windows starts, and then the graphics card does the rest.

    * Windows 10 apps are" target="_blank" title="">set to use Dark Mode where possible - since the March 2019 update this includes folder windows (Windows Explorer) and most - but not all - Windows 10 components

    * I have set the Windows 10 accent colours to something dark 

    * Windows 10" target="_blank" title="">system colours are set to a generally dark palette chosen by me, for example window borders and title bars are dark.  For reasons already explained, I do not choose a full "white text on black background" colour here because that breaks a few applications (hard-coded black text would become invisible with a black system background).  Obviously I do not want to be changing my Windows system colours for each different application I use, anyhow Windows requires a re-logon to update the colour palette so that would be practically impossible.  The best compromise is black text on a mid-range background.  The mid-range Windows system background colour is giving rise to the severity of the Pmail colour issue raised in this suggestion.

    * I have disabled Cortana in the Windows 10 task bar (an ugly white search box)

    * A nice Chrome extension, Stylish, allows the colour scheme of any website to be over-ridden by a user style.  Stylish is a popular tool and therefore the community has created good 'dark' user style for many popular websites, which you can choose and activate for each site, so I have these for Google, StackOverflow, Github and others that I use regularly, all of which have the tyrannical black text on a white background.


    I should probably write a blog post about all this, if I had a blog...

View as RSS news feed in XML

Contact | Advertise | Host provider: PraktIT | Terms of Use | Privacy Statement
Copyright © 2007-2011 David Harris / Peter Strömblad. | Pegasus Mail Home Page