Skip to content

Instantly share code, notes, and snippets.

@keflavich
Created November 10, 2012 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keflavich/4051742 to your computer and use it in GitHub Desktop.
Save keflavich/4051742 to your computer and use it in GitHub Desktop.
Black Background code mirror theme for ipython (based on https://gist.github.com/3858061)
from IPython.core.display import HTML
def blackbg():
"""Black Background code mirror theme."""
html = """
<style type="text/css">
.cm-s-ipython { background-color: black; color: lightblue; }
.cm-s-ipython span.cm-keyword {color: #00ff00; font-weight: bold;}
.cm-s-ipython span.cm-number {color: #ee88ee;}
.cm-s-ipython span.cm-operator {color: lime; font-weight: bold;}
.cm-s-ipython span.cm-meta {color: white;}
.cm-s-ipython span.cm-comment {color: cyan; font-style: italic;}
.cm-s-ipython span.cm-string {color: red;}
.cm-s-ipython span.cm-error {color: darkred;}
.cm-s-ipython span.cm-builtin {color: pink; font-weight: bold;}
.CodeMirror pre.CodeMirror-cursor {color: white; border-left: 1px solid white;}
.cm-s-ipython span.cm-variable {color: white;}
div.text_cell_input { background-color: black; color: white;}
div.text_cell { background-color: black; color: white;}
div#notebook { background-color: black; background-image: none; color: white;}
div.code_cell { background-color: black; color: white;}
div.metaedit .maintoolbar{ background-color: black; color: white;}
body{ background-color: black; color: white;}
#notebook_name { background-color: #333333; color: white; background-image:none;}
span.ui-widget-content{ background-color: #333333; color: white; background-image:none;}
div.ui-widget-content{ background-color: #333333; color: white; background-image:none;}
div#ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox{
background-color: black; color: white;}
div.input_area{ background-color: black; color: white;}
div.ui-widget-content { background-color: #333333; background-image: none;}
div.input_prompt {color:#6666CC; font-weight: bold;}
div.output_prompt {color:#CC6666; font-weight: bold;}
div.output_text {color:white;}
div.text_cell_render {color:white;}
span.item_name {color:white;}
.ui-widget-content a {color:white;}
div.tooltip .ui-corner-all .tooltiptext .smalltooltip {background-color: black; color:white;}
.pln {color:white}
.typ {color:#f9f}
.lit {color:#BBB}
.kwd {color:#3e3}
.metaedit {background: transparent; border-color: transparent; color:white;}
.ui-button-text {background: #112; color:white; border-color:666;}
.ui-menubar {background-color: transparent; background: transparent; background-image:none;}
.ui-widget-header {background-color: transparent; background: transparent; background-image:none;}
.ui-helper-clearfix {background-color: transparent; background: transparent; background-image:none;}
.ui-corner-all {background: #112; color: white;}
.ui-widget {background: #112; color: white;}
.ui-widget-content {background: #112; color: white;}
div.highlight {background:black;} /* needed for nbviewer */
div.output_stderr {background:#400;}
</style>"""
return HTML(html)
@Carreau
Copy link

Carreau commented Nov 11, 2012

great you find your way through the css.
Some text in MD cell are still black, be carefull.

@keflavich
Copy link
Author

Right, I still haven't figured out what to do about code blocks in markdown cells.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment