I am using Mathematica 12 on linux and would really like the dracula type theme for mathematica to match the overall theme of my system. I can use stylesheet to modify the notebook theme but this does not change the Menubar and the Scrollbars. Is there a way to change the colorscheme of the Menubar and the Scrollbars? Thanks for your time.

  • $\begingroup$ Unfortunately I don't know the answer, but it may also be helpful to mention what window manager you use. $\endgroup$
    – Carl Lange
    Commented Aug 31, 2021 at 14:03
  • $\begingroup$ I am using Kubuntu so KWin window manager. I have removed the border as well as hidden the title bar. KWin has no control on the menubar set by Mathematica. The menubar also does not respect the gtk or qt themes(i tried to force it). $\endgroup$
    – Bimaphys
    Commented Aug 31, 2021 at 14:17
  • 2
    $\begingroup$ The Linux FrontEnd looks for a custom Qt stylesheet in ~/.Mathematica/FrontEnd/frontend.css. You "should" be able to customize it using that. That is about all I can say about it though, I've never written one of these before. $\endgroup$
    – ihojnicki
    Commented Aug 31, 2021 at 19:54
  • 1
    $\begingroup$ DarkMode may be of interest. $\endgroup$
    – LouisB
    Commented Aug 31, 2021 at 19:54
  • $\begingroup$ @ihojnicki Wow, that's so helpful, thank you very much for that pointer. I had no idea. $\endgroup$
    – Carl Lange
    Commented Sep 1, 2021 at 15:29

1 Answer 1


Thanks to @ihojnicki, this is in fact possible.

Since the frontend looks in ~/.Mathematica/FrontEnd/frontend.css for custom Qt CSS, we can write our own to change the colours of the various elements.

Creating that file and adding the contents

QScrollBar:vertical {
  background: green;
  width: 20px;
QScrollBar::handle:vertical {
  background: red;
  min-height: 0px;
QMenu {
  background-color: #ababab; /* sets background of the menu */
  border: 1px solid black;

QMenu::item {
  /* sets background of menu item. set this to something non-transparent
        if you want menu color and menu item color to be different */
  background-color: transparent;

QMenu::item:selected {
  /* when user selects item using mouse or keyboard */
  background-color: #654321;

QMenuBar {
  background-color: qlineargradient(
    x1: 0,
    y1: 0,
    x2: 0,
    y2: 1,
    stop: 0 lightgray,
    stop: 1 red
  spacing: 3px; /* spacing between menu bar items */

QMenuBar::item {
  padding: 1px 4px;
  background: transparent;
  border-radius: 4px;

QMenuBar::item:selected {
  /* when selected using mouse or keyboard */
  background: #a8a8a8;

QMenuBar::item:pressed {
  background: #888888;

we can get this frankly beautiful colour arrangement:

enter image description here

Reading some of the Qt documentation should get you much of the way to a matching Frontend.

  • $\begingroup$ Thank you so much for the help. I created the file but nothing happened in my case. Is there some other step that I need to follow to tell mathematica to use the css file. I tried your code as well as a few other to realise that mathematica is not looking for the file ~/.Mathematica/FrontEnd/frontend.css $\endgroup$
    – Bimaphys
    Commented Sep 2, 2021 at 5:25
  • $\begingroup$ Oh yeah? What does $UserBaseDirectory evaluate to? $\endgroup$
    – Carl Lange
    Commented Sep 2, 2021 at 8:00
  • $\begingroup$ I checked it. It outputs ~/.Mathematica. $\endgroup$
    – Bimaphys
    Commented Sep 2, 2021 at 10:27
  • $\begingroup$ Strange - unfortunately I have no idea why it wouldn't pick it up, since it works perfectly for me. Perhaps @ihojnicki has some extra info. $\endgroup$
    – Carl Lange
    Commented Sep 2, 2021 at 11:40
  • $\begingroup$ @Bimaphys, which version are you using? 12.0? Look like this requires 12.1 or later. $\endgroup$
    – ihojnicki
    Commented Sep 2, 2021 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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