Skip to content
kyrylo edited this page Mar 25, 2013 · 18 revisions

Pry Theme has a command-line interface available via Pry. Just launch Pry and start working with it. But first, let's learn about the available subcommands.

Available commands:

Home page

Subcommands

list

Synopsis

Show a list of all installed themes.

Switches and arguments

-r|--remote — show a list of all themes from Pry Theme Collection. Possible arguments: none.

Accepts no arguments itself.

Examples

Show a list of local themes (watch):

[1] pry(main)> pry-theme list
monokai / 256
Based on Wimer Hazenberg's theme
--
1: class Theme
2:   def method
3:     @ivar, @@cvar, lvar = 10_000, 400.00, "string"
4:   end
5: end

pry-modern-8 / 8
Simplied version of pry-modern-16
--
1: class Theme
2:   def method
3:     @ivar, @@cvar, lvar = 10_000, 400.00, "string"
4:   end
5: end
…

Show a list of all remote themes (watch):

[1] pry(main)> pry-theme list --remote
Fetching the list of themes from Pry Theme Collection...
→ https://github.com/kyrylo/pry-theme-collection/
--
1. autumn
http://is.gd/1XrvaH

2. dominikh
http://is.gd/Dd1VVt
…

Back Back

colors

Synopsis

Show all available colors

Switches and arguments

-m|--model — display colors according to the given color model. Possible arguments: 8, 16 and 256.

Accepts no arguments itself.

Examples

Without the --model switch it displays the colors according to your terminal color capabilities (watch):

[1] pry(main)> pry-theme colors
Color model 256: 
  0:black                 86:aquamarine03           172:siena               
  1:maroon                87:cyan01                 173:dark_salmon         
  2:toad_in_love          88:maroon01               174:puce01              
  3:olive                 89:eggplant01             175:puce2    
…

Display only 8 colors (according to the 8 color model) (watch):

[1] pry(main)> pry-theme colors --model 8
Color model 8: 0:black  1:red  2:green  3:yellow  4:blue  5:magenta  6:cyan  7:white

Back Back

try

Synopsis

Change theme on the fly (for the current session only).

Switches and arguments

Accepts 1 argument, which is a name of the installed theme.

Examples

Temporary switch to the Solarized theme (watch):

[1] pry(main)> pry-theme try solarized
Using "solarized" theme
[2] pry(main)>

Back Back

edit

Synopsis

Edit a theme definiton. The command opens a theme in the editor you defined in Pry.config.editor. After you finished editing the theme, just exit the editor. Pry Theme will show you “before” and “after” snapshots and then reload theme (but it will not try it). This command is very useful if you use console based text editors (like Vim).

I find that cheatsheet very useful, because it shows code examples and appropriate token names.

Switches and arguments

Accepts 1 argument which is a name of the installed theme. Without the argument edits current theme.

Examples

Editing current theme (watch):

[1] pry(main)> pry-theme edit 
Opened in vim: /home/curacao/.pry/themes/zenburn.prytheme.rb
--------------------------------------------------------------------------------
                               Current "zenburn"                                
--------------------------------------------------------------------------------
# "zenburn" theme.
class PryTheme::ThisIsAClass
…
--------------------------------------------------------------------------------
                                Edited "zenburn"                                
--------------------------------------------------------------------------------
# "zenburn" theme.
class PryTheme::ThisIsAClass
…

Editing solarized theme (watch):

[1] pry(main)> pry-theme edit solarized
Opened in vim: /home/curacao/.pry/themes/solarized.prytheme.rb
--------------------------------------------------------------------------------
                              Current "solarized"                               
--------------------------------------------------------------------------------
# "solarized" theme.
class PryTheme::ThisIsAClass
…
--------------------------------------------------------------------------------
                               Edited "solarized"                               
--------------------------------------------------------------------------------
# "solarized" theme.
class PryTheme::ThisIsAClass
…

Back Back

uninstall

Synopsis

Uninstall a theme. Note that you cannot uninstall the default themes. Technically, you can do that, but they'll be restored on the next run of Pry.

Switches and parameters

Accepts multiple parameters that are theme names.

Examples

Uninstalling solarized and zenburn themes (they'll be restored anyway) (watch):

[1] pry(main)> pry-theme uninstall solarized zenburn
Successfully uninstalled "solarized"!
Successfully uninstalled "zenburn"!
[2] pry(main)> 

Back Back

install

Install a theme from Pry Theme Collection.

Switches and parameters

Accepts multiple parameters that are theme names.

Examples

Installing xoria256 theme (watch):

[1] pry(main)> pry-theme install autumn
Installing "autumn" from Pry Theme Collection...
Successfully installed "autumn"!
[2] pry(main)>

Back Back

current

Synopsis

Show information about currently active theme. Without the --colors switch displays current theme name.

Switches and arguments

-c|--colors — display a painted code snippet. Possible arguments: none.

Accepts no arguments itself.

Examples

Showing current theme name (watch):

[1] pry(main)> pry-theme current
zenburn

Showing current theme colors (watch):

[1] pry(main)> pry-theme current --colors
# "zenburn" theme.
class PryTheme::ThisIsAClass
…

Back Back

convert

Synopsis

Convert the given color to proper terminal equivalent.

Switches and arguments

-t|--term — show a terminal color. Possible arguments: 0-255.

-h|--hex — convert from HEX. Possible arguments: #000000-#FFFFFF.

-r|--rgb — convert from RGB. Possible arguments: 0,0,0-255,255,255.

-m|--model — convert accordingly to the given color model. Possible arguments: 8, 16 and 256.

Accepts no arguments itself.

Examples

Omitting the --model switch, so Pry Theme would guess it (different effect on different terminals) (watch):

[1] pry(main)> pry-theme convert --term 200
200:hot_pink03
[2] pry(main)>

Exactly the same invocation as the previous one (watch):

[1] pry(main)> pry-theme convert --model 256 --term 200
200:hot_pink03
[2] pry(main)>

Using the --term switch (watch):

[1] pry(main)> pry-theme convert --model 16 --term 15
37;1:bright_white
[2] pry(main)>

Using the --hex switch (watch):

[1] pry(main)> pry-theme convert --model 8 --hex #EA00AA
35:magenta
[2] pry(main)>

Using the --rgb switch (watch):

[1] pry(main)> pry-theme convert --model 256 --rgb 23,101,0
22:dark_spring_green
[2] pry(main)>

Back Back