def install_theme(theme, monofont='source', monosize=11, nbfont='exosans', nbfontsize=13, tcfont='merriserif', tcfontsize=13, margins='auto', cellwidth='980', lineheight=170, cursorwidth=2, cursorcolor='default', altlayout=False, altprompt=False, hideprompt=False, vimext=False, toolbar=False, nbname=False): """ Install theme to jupyter_customcss with specified font, fontsize, md layout, and toolbar pref """ from jupyterthemes import stylefx stylefx.reset_default(False) stylefx.check_directories() # initialize style_less & style_css style_less = stylefx.set_font_properties(monofont=monofont, monosize=monosize, nbfont=nbfont, nbfontsize=nbfontsize, tcfont=tcfont, tcfontsize=tcfontsize) # define some vars for cell layout cursorcolor = stylefx.get_colors(theme=theme, c=cursorcolor) style_less = stylefx.style_layout(style_less, theme=theme, cellwidth=cellwidth, margins=margins, lineheight=lineheight, altlayout=altlayout, altprompt=altprompt, hideprompt=hideprompt, cursorwidth=cursorwidth, cursorcolor=cursorcolor, vimext=vimext, toolbar=toolbar, nbname=nbname) # compile tempfile.less to css code and append to style_css style_css = stylefx.less_to_css(style_less) # append mathjax css & script to style_css style_css = stylefx.set_mathjax_style(style_css) # install style_css to .jupyter/custom/custom.css stylefx.write_final_css(style_css) # remove tempfile.less from package_dir stylefx.remove_temp_file()
def install_theme(theme, monofont='Hack', monosize=11, nbfontfam='sans-serif', tcfontfam='sans-serif', cellwidth=940, lineheight=160, altlayout=False, toolbar=False): """ install theme to css_fpath with specified font, fontsize, md layout, and toolbar pref """ from jupyterthemes import stylefx # initialize style_less & style_css style_less, style_css = '', '' if monofont != 'Hack': monofont, ital = stylefx.get_fonts('mono')[monofont] style_css = stylefx.import_monofont(style_css, fontname=monofont, ital=ital) style_less += '@import "styles/{}";\n'.format(theme) style_less = stylefx.set_monofont(style_less, monofont, monosize) style_less = stylefx.set_nb_font(style_less, nbfontfam) style_less = stylefx.set_txt_font(style_less, tcfontfam) # define some vars for cell layout style_less = stylefx.style_layout(style_less, cellwidth=cellwidth, lineheight=lineheight, altlayout=altlayout, toolbar=toolbar) # compile tempfile.less to css code and append to style_css style_css += less_to_css(style_less) # append mathjax css & script to style_css style_css = stylefx.set_mathjax(style_css) # install style_css to .jupyter/custom/custom.css custom_css = os.path.join(jupyter_custom, 'custom.css') with open(css_fpath, 'w') as custom_css: custom_css.write(style_css) # remove tempfile.less from package_dir os.remove(tempfile)
def install_theme(theme, monofont='droidmono', monosize=11, nbfont='exosans', nbfontsize=13, tcfont='georgiaserif', tcfontsize=13, cellwidth=980, lineheight=170, cursorwidth=2, cursorcolor='default', altlayout=False, vimext=False, toolbar=False, nbname=False): """ install theme to jupyter_customcss with specified font, fontsize, md layout, and toolbar pref """ from jupyterthemes import stylefx stylefx.reset_default(False) stylefx.check_directories() less_compatible = test_less_compatibility(theme) if not less_compatible: stylefx.install_precompiled_theme(theme) return None # initialize style_less & style_css style_less = stylefx.set_font_properties(monofont=monofont, monosize=monosize, nbfont=nbfont, nbfontsize=nbfontsize, tcfont=tcfont, tcfontsize=tcfontsize) # define some vars for cell layout cursorcolor = stylefx.get_colors(theme=theme, c=cursorcolor) style_less = stylefx.style_layout(style_less, theme=theme, cellwidth=cellwidth, lineheight=lineheight, altlayout=altlayout, cursorwidth=cursorwidth, cursorcolor=cursorcolor, vimext=vimext, toolbar=toolbar, nbname=nbname) # compile tempfile.less to css code and append to style_css style_css = stylefx.less_to_css(style_less) # append mathjax css & script to style_css style_css = stylefx.set_mathjax_style(style_css) # install style_css to .jupyter/custom/custom.css stylefx.write_final_css(style_css) # remove tempfile.less from package_dir stylefx.remove_temp_files(vimext=vimext)
def install_theme(theme, monofont=None, monosize=11, nbfont=None, nbfontsize=13, tcfont=None, tcfontsize=13, dffontsize=93, outfontsize=85, margins='auto', cellwidth='980', lineheight=170, cursorwidth=2, cursorcolor='default', altprompt=False, hideprompt=False, vimext=False, toolbar=False, nbname=False, dfonts=False): """ Install theme to jupyter_customcss with specified font, fontsize, md layout, and toolbar pref """ from jupyterthemes import stylefx stylefx.reset_default(False) stylefx.check_directories() doc = '\nConcatenated font imports, .less styles, & custom variables\n' s = '*' * 65 style_less = '\n'.join(['/*', s, s, doc, s, s, '*/']) style_less += '\n\n\n' style_less += '/* Import Notebook, Markdown, & Code Fonts */\n' # initialize style_less & style_css style_less = stylefx.set_font_properties( style_less=style_less, monofont=monofont, monosize=monosize, nbfont=nbfont, nbfontsize=nbfontsize, tcfont=tcfont, tcfontsize=tcfontsize, dffontsize=dffontsize, outfontsize=outfontsize, dfonts=dfonts) # define some vars for cell layout cursorcolor = stylefx.get_colors(theme=theme, c=cursorcolor) style_less = stylefx.style_layout( style_less, theme=theme, cellwidth=cellwidth, margins=margins, lineheight=lineheight, altprompt=altprompt, hideprompt=hideprompt, cursorwidth=cursorwidth, cursorcolor=cursorcolor, vimext=vimext, toolbar=toolbar, nbname=nbname) # compile tempfile.less to css code and append to style_css style_css = stylefx.less_to_css(style_less) # append mathjax css & script to style_css style_css = stylefx.set_mathjax_style(style_css) # install style_css to .jupyter/custom/custom.css stylefx.write_final_css(style_css) # remove tempfile.less from package_dir stylefx.remove_temp_file()
def install_theme(theme, monofont='droidmono', monosize=11, nbfont='exosans', nbfontsize=13, tcfont='loraserif', tcfontsize=13, margins='auto', cellwidth='980', lineheight=170, cursorwidth=2, cursorcolor='default', altlayout=False, altprompt=False, hideprompt=False, vimext=False, toolbar=False, nbname=False): """ Install theme to jupyter_customcss with specified font, fontsize, md layout, and toolbar pref """ from jupyterthemes import stylefx stylefx.reset_default(False) stylefx.check_directories() # initialize style_less & style_css style_less = stylefx.set_font_properties( monofont=monofont, monosize=monosize, nbfont=nbfont, nbfontsize=nbfontsize, tcfont=tcfont, tcfontsize=tcfontsize) # define some vars for cell layout cursorcolor = stylefx.get_colors(theme=theme, c=cursorcolor) style_less = stylefx.style_layout( style_less, theme=theme, cellwidth=cellwidth, margins=margins, lineheight=lineheight, altlayout=altlayout, altprompt=altprompt, hideprompt=hideprompt, cursorwidth=cursorwidth, cursorcolor=cursorcolor, vimext=vimext, toolbar=toolbar, nbname=nbname) # compile tempfile.less to css code and append to style_css style_css = stylefx.less_to_css(style_less) # append mathjax css & script to style_css style_css = stylefx.set_mathjax_style(style_css) # install style_css to .jupyter/custom/custom.css stylefx.write_final_css(style_css) # remove tempfile.less from package_dir stylefx.remove_temp_file()