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.
1 Answer
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:
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$– BimaphysSep 2, 2021 at 5:25 -
$\begingroup$ Oh yeah? What does
$UserBaseDirectory
evaluate to? $\endgroup$ Sep 2, 2021 at 8:00 -
-
$\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$ Sep 2, 2021 at 11:40
-
$\begingroup$ @Bimaphys, which version are you using? 12.0? Look like this requires 12.1 or later. $\endgroup$ Sep 2, 2021 at 12:53
~/.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$