48

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

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
lagoa
  • 835
  • 1
  • 7
  • 10

5 Answers5

40

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/

mde
  • 513
  • 4
  • 10
  • 2
    This is truly beautiful. Thanks, community bot! – LLlAMnYP Apr 30 '15 at 11:49
  • 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"]withStyleDefinitions->FrontEnd`FileName[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}, "Dimad.nb", CharacterEncoding -> "UTF-8"]` in "Dimand.nb" – sebhofer Aug 19 '16 at 09:23
  • 1
    @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? – An old man in the sea. Jul 31 '17 at 09:20
  • 1
    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. – Elias Riedel Gårding Apr 08 '19 at 05:14
  • @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. – MassDefect Apr 16 '19 at 18:32
  • I've installed and use the stylesheet successfully, but I've noticed that some of the formatting I get doesn't seem to match the definition in the sheet. For example, outputs are supposed to be styled in a greenish font on a lighter dark background, but when I use the stylesheets, they are exactly the same as inputs. Anyone has experienced this? – Whelp May 09 '19 at 13:56
  • Within the code on your StyleSheets you may want to change the how you reference the user folder from explicitly writing "dima" to '$Username'. This will help avoid problems when sharing your code or running it on a different computer. – cphys Feb 28 '20 at 00:25
  • Exactly how do I download those stylesheets? When I visit the GitHub repository and download code, I get only Ma***b stuff; if I right-click one of the actual Mathematica file links whose name begins with .Mathematica, I get the .html link, not the file. – murray Nov 25 '20 at 20:46
38
  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

Kuba
  • 136,707
  • 13
  • 279
  • 740
18

Wolfram Repository Function (WFR) entries:

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

Anton Antonov
  • 37,787
  • 3
  • 100
  • 178
2

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.

N0va
  • 3,370
  • 11
  • 16
1

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

murray
  • 11,888
  • 2
  • 26
  • 50