Exemplo n.º 1
0
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()
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
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()
Exemplo n.º 5
0
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()