MacOS – Dictionary styling (background color)

dictionarymacos

[OS 10.10.5]

I want the content background of the Dictionary app to be black. I know this can be done by editing the DefaultStyle.css file of each dictionary, but the background color is still bright white when there is no input in the Search box. How can I make the background color of Dictionary always black? Thanks.

(I know Mojave has Dark Mode, but I have no intention to upgrade my OS to Mojave for now.)

Best Answer

Here's the content of DefaultStyle.css file which I put in Contents subdirectory for each dictionary I have at ~/Library/Dictionaries and at /System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/:

@charset "UTF-8";
@namespace d url(http://www.apple.com/DTDs/DictionaryService-1.0.rng);

@media (prefers-dark-interface)
{

    html {
        -apple-color-filter: apple-invert-lightness();
    }
    a {
        -apple-color-filter: none;
        color: -webkit-link;
    }
    img {
        filter: invert(100%);
    }
}

It fixed the problem of background color for me, which appeared in Apple Dictionary somewhat after I migrated to Mojave.

I think you can edit background-color in this CSS as you want to achieve the result.