テクめも

プログラミング関連のちょっとしたTipsなどを書いています。

ptpythonのColorSchemeを変更する

ptpythonのカラースキーマを変更する方法を紹介します。

はじめに、ptpythonのconfigファイルをダウンロードします。

mkdir ~/.ptpython
wget https://raw.githubusercontent.com/prompt-toolkit/ptpython/master/examples/ptpython_config/config.py -P ~/.ptpython

configファイルの110行目あたりのuse_code_colorschemeがカラースキーマの定義なので、ここを変更します。

    # Use this colorscheme for the code.
    repl.use_code_colorscheme('pastie')

設定できる値は次のとおりです。

>>> import ptpython
>>> list(ptpython.style.get_all_styles())                                                                                              
['borland', 'monokai', 'manni', 'algol_nu', 'murphy', 'vim',
'pastie', 'arduino', 'rrt', 'xcode', 'igor', 'default', 'emacs',
'algol', 'colorful', 'native', 'autumn', 'lovelace', 'perldoc',
'paraiso-dark', 'paraiso-light', 'trac', 'rainbow_dash', 'abap',
'tango', 'vs', 'friendly', 'bw', 'fruity']

あとは、通常通り実行するだけです。

ptpython