37
$\begingroup$

The default white is very tiring for the eye after some hours.

$\endgroup$
4
  • $\begingroup$ Many people have their computer displays set too bright, which cause eye strain. That my be your problem. Try reducing the display's brightness. $\endgroup$ – m_goldberg Apr 19 '14 at 16:52
  • $\begingroup$ closely related: Invert Colors Stylesheet White on Black $\endgroup$ – Kuba Apr 30 '15 at 11:16
  • $\begingroup$ Was hoping they would add this in their Mojave update, but alas... $\endgroup$ – Max Coplan Sep 13 '19 at 1:18
  • $\begingroup$ I had this issue with my eyesight (light sensitivity and worse) and I am very happy to have found the solution. I told my eye doctor to give me computer glasses so that the formula is optimized for the distance between my eyes and the computer monitor. The resulting eyeglasses changed my life. $\endgroup$ – Gustavo Delfino Nov 24 '20 at 20:53
36
$\begingroup$

I created own dark theme for Mathematica. It looks like dark theme

All stylesheets needed for that you can found here [repo]=https://github.com/dmarienko/Matlab/tree/master/.Mathematica You need to copy .nb files from repo [repo]/SystemFiles/FrontEnd/StyleSheets/ to your local Mathematica StyleSheets folder. After that you can choose stylesheet named as Dimad.nb (You also may set it as default stylesheet). Also there is Plot's functions color palette for dark theme in [repo]/Kernel/init.m. You need to add it's content to your local .Mathematica/Kernel/init.m file. Hope it helps.

PS: All was done for Mathematica 9.0, I didn't test it for other versions.

PPS: It uses Ubuntu Mono as default font. It can be obtained here http://font.ubuntu.com/

$\endgroup$
8
  • 2
    $\begingroup$ This is truly beautiful. Thanks, community bot! $\endgroup$ – LLlAMnYP Apr 30 '15 at 11:49
  • $\begingroup$ I tried to use your stylesheet and I got an error saying that some file was not found. This can be corrected by replacing StyleDefinitions->FrontEnd`FileName[{$RootDirectory, "home", "dima", ".Mathematica", "SystemFiles", "FrontEnd", "StyleSheets"}, "Dimad.nb", CharacterEncoding -> "UTF-8"] with StyleDefinitions->FrontEnd`FileName[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}, "Dimad.nb", CharacterEncoding -> "UTF-8"] in "Dimand.nb" $\endgroup$ – sebhofer Aug 19 '16 at 9:23
  • 1
    $\begingroup$ @sebhofer I've put the Dimad.nb in the Stylesheet Mathematica folder. I open a new notebook, and change the style sheet in the format drop-down menu. But nothing happens. I still get a white background... Could you help me? $\endgroup$ – An old man in the sea. Jul 31 '17 at 9:20
  • $\begingroup$ How did you manage to get a dark colour for the window frame, scrollbars etc? When I try your config, it only applies to the notebook contents. $\endgroup$ – Elias Riedel Gårding Apr 8 '19 at 5:14
  • $\begingroup$ @EliasRiedelGårding I could be wrong, but it looks to me like they are using Mathematica on Linux, and that's simply the default frame and scrollbar style on that OS. If you're using Windows or macOS, you may be stuck with the default colours there. I know on macOS, my frame is a light colour despite having the systemwide "dark theme" preference enabled. $\endgroup$ – MassDefect Apr 16 '19 at 18:32
30
$\begingroup$
  1. Built-in Format -> Stylesheet -> ReverseColor:

    I don't know how about you but I missed the fact it is built-in since V 10.

    enter image description here

  2. Custom one

    I didn't like to coloring in ReverseColor much so I patched it a little and added to my https://github.com/kubaPod/DevTools

    I was focusing on making it neat for .m files rather than .nb so it may look weird in place of default styles.

    See https://mathematica.stackexchange.com/a/164654/5478 or Github readme for installation steps.

    enter image description here

$\endgroup$
2
  • $\begingroup$ Now how can I set this as the default... $\endgroup$ – Andrew Feb 8 '16 at 17:10
  • 1
    $\begingroup$ This is probably a bug but with Mathematica 10.4 Student Edition (on Linux), the output box does not invert color properly. imgur.com/DUPlpI1 $\endgroup$ – typesanitizer Jun 30 '16 at 19:45
13
$\begingroup$

Wolfram Repository Function (WFR) entries:

(DarkMode is hard to find using WFR's search interface...)

$\endgroup$
3
  • 1
    $\begingroup$ +1 since you helped me learn there is is a ResourceFunction called "Bob". $\endgroup$ – bobthechemist Nov 24 '20 at 17:31
  • 1
    $\begingroup$ I was convinced DarkMode was removed, I couldn't find it at all. Nice find! $\endgroup$ – morbo Nov 24 '20 at 19:34
  • 1
    $\begingroup$ @bobthechemist Is talking about this resource function: Bob -- very useful and needed function. (After you see it used...) $\endgroup$ – Anton Antonov Nov 24 '20 at 23:21
1
$\begingroup$

The quickest thing might be to modify the default stylesheet and save it as a new one. You can find a good description of how to do that on David Park's Mathematica page http://home.comcast.net/~djmpark/Mathematica.html.

If you want a ready-made stylesheet, I've found David Park's PresentationsStyle stylesheet especially easy on the eyes. It not only uses a light brownish background but changes other styles so as to harmonize. If you own Park's Presentations add-on, then you already have this stylesheet. If you don't, you can obtain it as part of his newly-available FreePresentations add-on (which allows you to read documents prepared with the full Presentations but not conveniently to author new ones):

http://home.comcast.net/~djmpark/DrawGraphicsPage.html

$\endgroup$
1
  • 2
    $\begingroup$ Links are not reachable anymore $\endgroup$ – Kuba Mar 17 '17 at 22:01
1
$\begingroup$

I also created my own Mathematica stylesheet (github.com/MJSteil/Mathematica-DarkTheme) which includes a dark themed Screen Environment.

Notebook

There are multiple advantages of defining the dark theme for a given stylesheet using a so called style environment in the stylesheet (in addition to the canonical environments Working, Printing and Presentation) instead of using a separate stylesheet for the dark theme.

Stylesheet

While I occasionally like working with a dark theme, for output and presentation a light themed notebook often feels/looks better in my opinion. Switching between Screen Environments using the front end/menu (Format->Screen Environment->...) or e.g. SetOptions[EvaluationNotebook[],ScreenStyleEnvironment->"..."] is in my opinion much more convenient than changing the actual stylesheet of the notebook (which might delete/overwrite custom/private style definitions).

The colors of my dark theme are loosely based on the Dracula theme in JetBrains CLion and I used strategies and adapted style definitions from various sources/dark themes to piece together my stylesheet. The stylesheet is not perfect and some modifications in the notebooks and or the stylesheet itself (for e.g. plotting) might be advisable/necessary to use the dark theme as a default. I mainly use it for coding.

Apart from the definitions related the dark working environment WorkingDark my stylesheet includes modifications of the Printing environment and some modified and special cells. The most notable changes here are that I use Code cells which per redefined default are not Initialization Cells for most of my input in the notebooks since I like to manually indent my code (I am unhappy with the default code indentation of Mathematica). Further more I have defined NonEvaluating versions for most cells (e.g. Section, Input, Code and more) which I use extensively in my notebooks to temporarily or in some cases permanently exclude code and entire sections of code from evaluation. Those NonEvaluating cells have a distinct (gray) formatting and are implemented by setting PrivateCellOptions->{"CellGroupBaseStyle"->{Evaluatable -> False}} or Evaluatable->False in their styles.

Further -- non-stylesheet -- modification one could consider when using dark themed notebooks (of any kind) is to use a custom MiscExpressions.tr file in $UserBaseDirectory\SystemFiles\FrontEnd\TextResources which uses a custom CellInsertionPointBitmap.png for the "CellInsertionMenu" since the default graphics of Mathematica includes a gradient which makes the icon almost invisible on a dark background. Another possible and potentially useful modification/addition to the front end related to the NonEvaluating cells is the addition of

Item[KeyEvent["Keypad1", Modifiers -> {Control}], 
    KernelExecute[{
        SelectionMove[InputNotebook[], All, Cell];
         With[{style=Replace["Style",First[Developer`CellInformation[SelectedNotebook[]]]]},
            If[StringContainsQ[style, "NonEvaluating"],
                FrontEndTokenExecute[SelectedNotebook[], "Style", StringReplace[style,"NonEvaluating" -> ""]];,
                FrontEndTokenExecute[SelectedNotebook[], "Style", StringJoin["NonEvaluating", style]];
            ];
        ];
    }],
MenuEvaluator->Automatic]

to a user-version of KeyEventTranslations.tr under $UserBaseDirectory\SystemFiles\FrontEnd\TextResources\Windows (or corresponding folders for other operating systems) which switches the cell style of a selected cell between the plain and NonEvaluating version of the cell when pressing Controll+Keypad1. This does not work as expected/intended when selecting cells of multiple/different styles but works very well for cells with the same style/type.

Disclaimer: Modification of system files like MiscExpressions.tr and KeyEventTranslations.tr are "likely prohibited by the EULA" [see e.g. the discussion in https://mathematica.stackexchange.com/a/15408/] and I therefore do neither recommend nor provide such modified files. I am only pointing out the theoretical technical possibility of such modifications. This disclaimer does not concern the use of user defined stylesheets.

$\endgroup$
1
  • $\begingroup$ Great! Please consider submitting a Wolfram Resource Function as the ones linked in this answer. $\endgroup$ – Anton Antonov Nov 25 '20 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.