pry-theme 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +8 -1
  4. data/CHANGELOG.md +40 -0
  5. data/Gemfile +1 -1
  6. data/README.md +26 -48
  7. data/Rakefile +10 -1
  8. data/VERSION +1 -0
  9. data/lib/pry-theme/basic_editor.rb +116 -0
  10. data/lib/pry-theme/color.rb +431 -0
  11. data/lib/pry-theme/color_table.rb +39 -0
  12. data/lib/pry-theme/colors/color16.rb +35 -0
  13. data/lib/pry-theme/colors/color256.rb +30 -0
  14. data/lib/pry-theme/colors/color8.rb +31 -0
  15. data/lib/pry-theme/commands.rb +237 -275
  16. data/lib/pry-theme/declaration.rb +120 -0
  17. data/lib/pry-theme/definition.rb +111 -0
  18. data/lib/pry-theme/formattable.rb +26 -0
  19. data/lib/pry-theme/hex.rb +76 -0
  20. data/lib/pry-theme/preview.rb +74 -0
  21. data/lib/pry-theme/rgb.rb +238 -13
  22. data/lib/pry-theme/term.rb +66 -0
  23. data/lib/pry-theme/theme.rb +116 -26
  24. data/lib/pry-theme/theme_list.rb +52 -0
  25. data/lib/pry-theme/when_started_hook.rb +25 -27
  26. data/lib/pry-theme.rb +84 -158
  27. data/pry-theme.gemspec +14 -18
  28. data/spec/color_table.rb +53 -0
  29. data/spec/colors/color16_spec.rb +255 -0
  30. data/spec/colors/color256_spec.rb +323 -0
  31. data/spec/colors/color8_spec.rb +254 -0
  32. data/spec/commands_spec.rb +203 -0
  33. data/spec/helper.rb +16 -0
  34. data/spec/hex_spec.rb +52 -0
  35. data/spec/rgb_spec.rb +81 -0
  36. data/spec/term_spec.rb +23 -0
  37. data/spec/theme_spec.rb +486 -0
  38. data/themes/github.prytheme.rb +49 -0
  39. data/themes/monokai.prytheme.rb +48 -0
  40. data/themes/pry-classic-16.prytheme.rb +48 -0
  41. data/themes/pry-classic-256.prytheme.rb +48 -0
  42. data/themes/pry-classic-8.prytheme.rb +48 -0
  43. data/themes/pry-cold.prytheme.rb +49 -0
  44. data/themes/pry-love-16.prytheme.rb +48 -0
  45. data/themes/pry-love-8.prytheme.rb +48 -0
  46. data/themes/pry-modern-16.prytheme.rb +48 -0
  47. data/themes/pry-modern-256.prytheme.rb +48 -0
  48. data/themes/pry-modern-8.prytheme.rb +48 -0
  49. data/themes/pry-monochrome.prytheme.rb +32 -0
  50. data/themes/pry-siberia-16.prytheme.rb +48 -0
  51. data/themes/pry-siberia-8.prytheme.rb +48 -0
  52. data/themes/pry-tepid-16.prytheme.rb +48 -0
  53. data/themes/pry-tepid-8.prytheme.rb +48 -0
  54. data/themes/pry-zealand-16.prytheme.rb +48 -0
  55. data/themes/pry-zealand-8.prytheme.rb +49 -0
  56. data/themes/railscasts.prytheme.rb +50 -0
  57. data/themes/solarized.prytheme.rb +48 -0
  58. data/themes/tomorrow.prytheme.rb +48 -0
  59. data/themes/twilight.prytheme.rb +48 -0
  60. data/themes/vim-default.prytheme.rb +50 -0
  61. data/themes/vim-detailed.prytheme.rb +50 -0
  62. data/themes/zenburn.prytheme.rb +48 -0
  63. metadata +56 -41
  64. data/lib/pry-theme/color_converter.rb +0 -55
  65. data/lib/pry-theme/helper.rb +0 -87
  66. data/lib/pry-theme/palette.rb +0 -85
  67. data/lib/pry-theme/term_notation.rb +0 -17
  68. data/lib/pry-theme/version.rb +0 -3
  69. data/test/fixtures/pry-classic.prytheme +0 -38
  70. data/test/helper.rb +0 -56
  71. data/test/test_color_converter.rb +0 -38
  72. data/test/test_commands.rb +0 -55
  73. data/test/test_helper.rb +0 -45
  74. data/test/test_palette.rb +0 -11
  75. data/themes/github.prytheme +0 -43
  76. data/themes/monokai.prytheme +0 -42
  77. data/themes/pry-classic.prytheme +0 -43
  78. data/themes/pry-cold.prytheme +0 -43
  79. data/themes/pry-modern.prytheme +0 -42
  80. data/themes/railscasts.prytheme +0 -44
  81. data/themes/saturday.prytheme +0 -42
  82. data/themes/solarized.prytheme +0 -43
  83. data/themes/tomorrow.prytheme +0 -43
  84. data/themes/twilight.prytheme +0 -42
  85. data/themes/vim-default.prytheme +0 -42
  86. data/themes/vim-detailed.prytheme +0 -42
  87. data/themes/zenburn.prytheme +0 -43
@@ -0,0 +1,50 @@
1
+ t = PryTheme.create :name => 'railscasts' do
2
+ author :name => 'Ryan Fitzgerald'
3
+ author :name => 'John Mair'
4
+ author :name => 'Kyrylo Silin', :email => 'kyrylosilin@gmail.com'
5
+ description 'The famous RailsCasts theme'
6
+
7
+ define_theme do
8
+ class_ 'white'
9
+ class_variable 'robin_egg_blue03'
10
+ comment 'tan'
11
+ constant 'white'
12
+ error 'white', 'maroon'
13
+ float 'asparagus'
14
+ global_variable :bg => 'robin_egg_blue03'
15
+ inline_delimiter 'emerald02'
16
+ instance_variable 'robin_egg_blue03'
17
+ integer 'asparagus'
18
+ keyword 'international_orange'
19
+ method 'mustard02'
20
+ predefined_constant 'robin_egg_blue03'
21
+ symbol 'cornflower_blue01'
22
+
23
+ regexp do
24
+ self_ 'asparagus'
25
+ char 'orange'
26
+ content 'asparagus'
27
+ delimiter 'asparagus'
28
+ modifier 'asparagus'
29
+ escape 'emerald02'
30
+ end
31
+
32
+ shell do
33
+ self_ 'asparagus'
34
+ char 'orange'
35
+ content 'asparagus'
36
+ delimiter 'asparagus'
37
+ escape 'emerald02'
38
+ end
39
+
40
+ string do
41
+ self_ 'asparagus'
42
+ char 'orange'
43
+ content 'asparagus'
44
+ delimiter 'asparagus'
45
+ escape 'emerald02'
46
+ end
47
+ end
48
+ end
49
+
50
+ PryTheme::ThemeList.add_theme(t)
@@ -0,0 +1,48 @@
1
+ t = PryTheme.create :name => 'solarized' do
2
+ author :name => 'Kyrylo Silin', :email => 'kyrylosilin@gmail.com'
3
+ description 'Precision colors for machines and people'
4
+
5
+ define_theme do
6
+ class_ 'dark_goldenrod'
7
+ class_variable 'azure01'
8
+ comment 'wet_asphalt05'
9
+ constant 'dark_goldenrod'
10
+ error 'abdel_kerims_beard04'
11
+ float 'robin_egg_blue01'
12
+ global_variable 'azure01'
13
+ inline_delimiter 'titian'
14
+ instance_variable 'azure01'
15
+ integer 'robin_egg_blue01'
16
+ keyword 'gray03', [:bold]
17
+ method 'azure01'
18
+ predefined_constant 'azure01'
19
+ symbol 'robin_egg_blue01'
20
+
21
+ regexp do
22
+ self_ 'olive_drab'
23
+ char 'titian'
24
+ content 'olive_drab'
25
+ delimiter 'titian'
26
+ modifier 'titian'
27
+ escape 'titian'
28
+ end
29
+
30
+ shell do
31
+ self_ 'titian'
32
+ char 'titian'
33
+ content 'robin_egg_blue01'
34
+ delimiter 'titian'
35
+ escape 'titian'
36
+ end
37
+
38
+ string do
39
+ self_ 'titian'
40
+ char 'titian'
41
+ content 'robin_egg_blue01'
42
+ delimiter 'titian'
43
+ escape 'robin_egg_blue01'
44
+ end
45
+ end
46
+ end
47
+
48
+ PryTheme::ThemeList.add_theme(t)
@@ -0,0 +1,48 @@
1
+ t = PryTheme.create :name => 'tomorrow' do
2
+ author :name => 'John Mair'
3
+ description 'A theme should not get in your way'
4
+
5
+ define_theme do
6
+ class_ 'gold'
7
+ class_variable 'alizarin'
8
+ comment 'gray03'
9
+ constant 'gold'
10
+ error 'tangerine', [:italic]
11
+ float 'tangerine'
12
+ global_variable 'alizarin'
13
+ inline_delimiter 'heliotrope01'
14
+ instance_variable 'alizarin'
15
+ integer 'tangerine'
16
+ keyword 'heliotrope03'
17
+ method 'royal_blue05'
18
+ predefined_constant 'tangerine'
19
+ symbol 'old_gold'
20
+
21
+ regexp do
22
+ self_ 'alizarin'
23
+ char 'heliotrope01'
24
+ content 'old_gold'
25
+ delimiter 'alizarin'
26
+ modifier 'old_gold'
27
+ escape 'heliotrope01'
28
+ end
29
+
30
+ shell do
31
+ self_ 'gray02'
32
+ char 'heliotrope01'
33
+ content 'puce01'
34
+ delimiter 'gray02'
35
+ escape 'heliotrope01'
36
+ end
37
+
38
+ string do
39
+ self_ 'old_gold'
40
+ char 'heliotrope01'
41
+ content 'old_gold'
42
+ delimiter 'old_gold'
43
+ escape 'heliotrope01'
44
+ end
45
+ end
46
+ end
47
+
48
+ PryTheme::ThemeList.add_theme(t)
@@ -0,0 +1,48 @@
1
+ t = PryTheme.create :name => 'twilight' do
2
+ author :name => 'John Mair'
3
+ description 'Based on Twilight from Emacs color-theme package'
4
+
5
+ define_theme do
6
+ class_ 'vert_de_peche'
7
+ class_variable 'pale_cornflower_blue', [:bold]
8
+ comment 'gray03'
9
+ constant 'vert_de_peche'
10
+ error 'tenne', [:italic]
11
+ float 'silver01'
12
+ global_variable 'pale_cornflower_blue'
13
+ inline_delimiter 'pistachio01'
14
+ instance_variable 'cornflower_blue02'
15
+ integer 'pale_blue01'
16
+ keyword 'brass02', [:bold]
17
+ method 'ochre', [:bold]
18
+ predefined_constant 'pale_cornflower_blue'
19
+ symbol 'chestnut01'
20
+
21
+ regexp do
22
+ self_ 'moss_green'
23
+ char 'pistachio01'
24
+ content 'old_gold'
25
+ delimiter 'moss_green'
26
+ modifier 'pale_cornflower_blue'
27
+ escape 'pistachio01'
28
+ end
29
+
30
+ shell do
31
+ self_ 'moss_green'
32
+ char 'pistachio01'
33
+ content 'moss_green'
34
+ delimiter 'moss_green'
35
+ escape 'pistachio01'
36
+ end
37
+
38
+ string do
39
+ self_ 'moss_green'
40
+ char 'pistachio01'
41
+ content 'moss_green'
42
+ delimiter 'moss_green'
43
+ escape 'pistachio01'
44
+ end
45
+ end
46
+ end
47
+
48
+ PryTheme::ThemeList.add_theme(t)
@@ -0,0 +1,50 @@
1
+ # coding: utf-8
2
+
3
+ t = PryTheme.create :name => 'vim-default', :color_model => 8 do
4
+ author :name => '☈king', :email => 'rking-pry-vimscheme@sharpsaw.org'
5
+ description 'For those familiar with the default vim colorscheme'
6
+
7
+ define_theme do
8
+ class_ 'green'
9
+ class_variable 'cyan'
10
+ comment 'blue'
11
+ constant 'green'
12
+ error 'white', 'red'
13
+ float 'red'
14
+ global_variable 'cyan'
15
+ inline_delimiter 'red'
16
+ instance_variable 'cyan'
17
+ integer 'red'
18
+ keyword 'magenta' # some should be yellow. CodeRay's limited.
19
+ method 'cyan'
20
+ predefined_constant 'cyan'
21
+ symbol 'red'
22
+
23
+ regexp do
24
+ self_ 'magenta'
25
+ char 'red'
26
+ content 'red'
27
+ delimiter 'magenta'
28
+ modifier 'magenta'
29
+ escape 'red'
30
+ end
31
+
32
+ shell do
33
+ self_ 'magenta'
34
+ char 'red'
35
+ content 'red'
36
+ delimiter 'magenta'
37
+ escape 'red'
38
+ end
39
+
40
+ string do
41
+ self_ 'magenta'
42
+ char 'red'
43
+ content 'red'
44
+ delimiter 'magenta'
45
+ escape 'red'
46
+ end
47
+ end
48
+ end
49
+
50
+ PryTheme::ThemeList.add_theme(t)
@@ -0,0 +1,50 @@
1
+ # coding: utf-8
2
+
3
+ t = PryTheme.create :name => 'vim-detailed' do
4
+ author :name => '☈king', :email => 'rking-pry-vim-detailed@sharpsaw.org'
5
+ description "Lil' pal of http://www.vim.org/scripts/script.php?script_id=4297"
6
+
7
+ define_theme do
8
+ class_ 'vert_de_pomme02' # (originally: green)
9
+ class_variable 'bluish01', 'flea_belly' # Intentionally ugly as a warning
10
+ comment 'wet_asphalt07' # (originally: blue)
11
+ constant 'vert_de_pomme01' # (originally: green)
12
+ error 'black', 'bismarck_furious' # (originally: white, red)
13
+ float 'titian' # (originally: red)
14
+ global_variable 'cerise01', 'black03' # Intentionally ugly as chastisement
15
+ inline_delimiter 'pale_mauve02', [:italic]
16
+ instance_variable 'light_blue02' # (originally: cyan)
17
+ integer 'bismarck_furious' # (originally: red)
18
+ keyword 'magenta'
19
+ method 'royal_blue02', [:bold] # (originally: cyan)
20
+ predefined_constant 'pale_mauve02' # (originally: cyan)
21
+ symbol 'cornflower_blue02' # (originally: red)
22
+
23
+ regexp do
24
+ self_ 'maroon01' # (originally: magenta)
25
+ char 'red', 'black03' # (originally: red)
26
+ content 'red', 'black03' # (originally: red)
27
+ delimiter 'maroon01' # (originally: magenta)
28
+ modifier 'lilac01' # (originally: magenta)
29
+ escape 'violet_eggplant', [:bold]
30
+ end
31
+
32
+ shell do
33
+ self_ 'pale_mauve02' # (originally: red)
34
+ char 'eggplant02', 'black03'
35
+ content 'eggplant02' # (originally: red)
36
+ delimiter 'bright_violet', 'black03' # (originally: magenta)
37
+ escape 'eggplant02', [:bold]
38
+ end
39
+
40
+ string do
41
+ self_ 'titian' # (originally: red)
42
+ char 'violet_eggplant01', 'black03'
43
+ content 'bismarck_furious', 'black03'
44
+ delimiter 'azure01' # (originally: magenta)
45
+ escape 'violet_eggplant01', 'black03' # (originally: red)
46
+ end
47
+ end
48
+ end
49
+
50
+ PryTheme::ThemeList.add_theme(t)
@@ -0,0 +1,48 @@
1
+ t = PryTheme.create :name => 'zenburn' do
2
+ author :name => 'Kyrylo Silin', :email => 'kyrylosilin@gmail.com'
3
+ description 'A low-contrast color scheme'
4
+
5
+ define_theme do
6
+ class_ 'dark_peach', [:bold]
7
+ class_variable 'dark_peach'
8
+ comment 'swamp_green01'
9
+ constant 'dark_peach', [:bold]
10
+ error 'tenne', [:italic]
11
+ float 'silver01'
12
+ global_variable 'dark_peach'
13
+ inline_delimiter 'gray02'
14
+ instance_variable 'dark_peach'
15
+ integer 'pale_blue01'
16
+ keyword 'dark_salmon', [:bold]
17
+ method 'corn02'
18
+ predefined_constant 'dark_peach'
19
+ symbol 'puce01', [:bold]
20
+
21
+ regexp do
22
+ self_ 'gray02'
23
+ char 'gray02'
24
+ content 'puce01'
25
+ delimiter 'gray02'
26
+ modifier 'gray02'
27
+ escape 'gray02'
28
+ end
29
+
30
+ shell do
31
+ self_ 'gray02'
32
+ char 'gray02'
33
+ content 'puce01'
34
+ delimiter 'gray02'
35
+ escape 'gray02'
36
+ end
37
+
38
+ string do
39
+ self_ 'gray02'
40
+ char 'gray02'
41
+ content 'puce01'
42
+ delimiter 'gray02'
43
+ escape 'gray02'
44
+ end
45
+ end
46
+ end
47
+
48
+ PryTheme::ThemeList.add_theme(t)
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kyrylo Silin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-21 00:00:00.000000000 Z
11
+ date: 2013-03-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bacon
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: pry
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,12 +62,11 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
- description: The plugin enables color theme support for your Pry. No more .pryrc bustling.
69
+ description: The plugin enables color theme support for Pry.
79
70
  email: kyrylosilin@gmail.com
80
71
  executables: []
81
72
  extensions: []
@@ -88,65 +79,89 @@ files:
88
79
  - LICENSE
89
80
  - README.md
90
81
  - Rakefile
82
+ - VERSION
91
83
  - lib/pry-theme.rb
84
+ - lib/pry-theme/basic_editor.rb
92
85
  - lib/pry-theme/cli.rb
93
- - lib/pry-theme/color_converter.rb
86
+ - lib/pry-theme/color.rb
87
+ - lib/pry-theme/color_table.rb
88
+ - lib/pry-theme/colors/color16.rb
89
+ - lib/pry-theme/colors/color256.rb
90
+ - lib/pry-theme/colors/color8.rb
94
91
  - lib/pry-theme/commands.rb
95
- - lib/pry-theme/helper.rb
96
- - lib/pry-theme/palette.rb
92
+ - lib/pry-theme/declaration.rb
93
+ - lib/pry-theme/definition.rb
94
+ - lib/pry-theme/formattable.rb
95
+ - lib/pry-theme/hex.rb
96
+ - lib/pry-theme/preview.rb
97
97
  - lib/pry-theme/rgb.rb
98
- - lib/pry-theme/term_notation.rb
98
+ - lib/pry-theme/term.rb
99
99
  - lib/pry-theme/theme.rb
100
- - lib/pry-theme/version.rb
100
+ - lib/pry-theme/theme_list.rb
101
101
  - lib/pry-theme/when_started_hook.rb
102
102
  - pry-theme.gemspec
103
103
  - screenshots/railscasts.png
104
104
  - screenshots/solarized.png
105
105
  - screenshots/tomorrow.png
106
106
  - screenshots/zenburn.png
107
- - test/fixtures/pry-classic.prytheme
108
- - test/helper.rb
109
- - test/test_color_converter.rb
110
- - test/test_commands.rb
111
- - test/test_helper.rb
112
- - test/test_palette.rb
113
- - themes/github.prytheme
114
- - themes/monokai.prytheme
115
- - themes/pry-classic.prytheme
116
- - themes/pry-cold.prytheme
117
- - themes/pry-modern.prytheme
118
- - themes/railscasts.prytheme
119
- - themes/saturday.prytheme
120
- - themes/solarized.prytheme
121
- - themes/tomorrow.prytheme
122
- - themes/twilight.prytheme
123
- - themes/vim-default.prytheme
124
- - themes/vim-detailed.prytheme
125
- - themes/zenburn.prytheme
107
+ - spec/color_table.rb
108
+ - spec/colors/color16_spec.rb
109
+ - spec/colors/color256_spec.rb
110
+ - spec/colors/color8_spec.rb
111
+ - spec/commands_spec.rb
112
+ - spec/helper.rb
113
+ - spec/hex_spec.rb
114
+ - spec/rgb_spec.rb
115
+ - spec/term_spec.rb
116
+ - spec/theme_spec.rb
117
+ - themes/github.prytheme.rb
118
+ - themes/monokai.prytheme.rb
119
+ - themes/pry-classic-16.prytheme.rb
120
+ - themes/pry-classic-256.prytheme.rb
121
+ - themes/pry-classic-8.prytheme.rb
122
+ - themes/pry-cold.prytheme.rb
123
+ - themes/pry-love-16.prytheme.rb
124
+ - themes/pry-love-8.prytheme.rb
125
+ - themes/pry-modern-16.prytheme.rb
126
+ - themes/pry-modern-256.prytheme.rb
127
+ - themes/pry-modern-8.prytheme.rb
128
+ - themes/pry-monochrome.prytheme.rb
129
+ - themes/pry-siberia-16.prytheme.rb
130
+ - themes/pry-siberia-8.prytheme.rb
131
+ - themes/pry-tepid-16.prytheme.rb
132
+ - themes/pry-tepid-8.prytheme.rb
133
+ - themes/pry-zealand-16.prytheme.rb
134
+ - themes/pry-zealand-8.prytheme.rb
135
+ - themes/railscasts.prytheme.rb
136
+ - themes/solarized.prytheme.rb
137
+ - themes/tomorrow.prytheme.rb
138
+ - themes/twilight.prytheme.rb
139
+ - themes/vim-default.prytheme.rb
140
+ - themes/vim-detailed.prytheme.rb
141
+ - themes/zenburn.prytheme.rb
126
142
  homepage: https://github.com/kyrylo/pry-theme
127
143
  licenses:
128
144
  - zlib
145
+ metadata: {}
129
146
  post_install_message:
130
147
  rdoc_options: []
131
148
  require_paths:
132
149
  - lib
133
150
  required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
151
  requirements:
136
152
  - - ! '>='
137
153
  - !ruby/object:Gem::Version
138
154
  version: '0'
139
155
  required_rubygems_version: !ruby/object:Gem::Requirement
140
- none: false
141
156
  requirements:
142
157
  - - ! '>='
143
158
  - !ruby/object:Gem::Version
144
159
  version: '0'
145
160
  requirements: []
146
161
  rubyforge_project:
147
- rubygems_version: 1.8.24
162
+ rubygems_version: 2.0.3
148
163
  signing_key:
149
- specification_version: 3
150
- summary: Easy way to customize your Pry colors
164
+ specification_version: 4
165
+ summary: An easy way to customize Pry colors via theme files
151
166
  test_files: []
152
167
  has_rdoc:
@@ -1,55 +0,0 @@
1
- module PryTheme
2
- module ColorConverter
3
-
4
- extend self
5
-
6
- COLORS = Palette.new(256).colors
7
-
8
- def rgb_to_hex(rgb)
9
- "#%02x%02x%02x" % rgb.split(",")
10
- end
11
-
12
- def rgb_to_ansi(rgb)
13
- hex_to_ansi(rgb_to_hex(rgb))
14
- end
15
-
16
- def hex_to_rgb(hex)
17
- if m = hex.match(/\A#?([A-F\d]{2})([A-F\d]{2})([A-F\d]{2})\z/i)
18
- m.captures.map(&:hex)
19
- end
20
- end
21
-
22
- def hex_to_ansi(hex)
23
- rgb = hex_to_rgb(hex)
24
-
25
- unless Helper.rgb?(rgb.join(","))
26
- return
27
- end
28
-
29
- if color = RGB.table.index(rgb)
30
- return COLORS.find { |c| c.term == color }.term
31
- end
32
-
33
- increments = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff]
34
- rgb.map! do |part|
35
- for i in (0..4)
36
- lower, upper = increments[i], increments[i+1]
37
-
38
- next unless part.between?(lower, upper)
39
-
40
- distance_from_lower = (lower - part).abs
41
- distance_from_upper = (upper - part).abs
42
- closest = distance_from_lower < distance_from_upper ? lower : upper
43
- end
44
- closest
45
- end
46
-
47
- COLORS.find { |c| c.term == RGB.table.index(rgb) }.term
48
- end
49
-
50
- def ansi_to_hex(ansi)
51
- "#" + RGB.table[ansi].map { |v| (v.to_s(16) * 2)[0...2] }.join
52
- end
53
-
54
- end
55
- end
@@ -1,87 +0,0 @@
1
- module PryTheme
2
- module Helper
3
-
4
- module_function
5
-
6
- def example_themes
7
- (Dir.entries(EXAMPLES_ROOT) - %w{ . .. })
8
- end
9
-
10
- def installed_themes
11
- (Dir.entries(THEME_DIR) - %w{ . .. })
12
- end
13
-
14
- def installed?(theme)
15
- installed_themes.any? { |t| /\A#{theme}.prytheme\z/ =~ t }
16
- end
17
-
18
- def lputs(text, out=nil)
19
- Pry::Helpers::BaseHelpers.stagger_output(text, out)
20
- end
21
-
22
- def make_bold(text)
23
- Pry::Helpers::Text.bold(text)
24
- end
25
-
26
- def theme_file_version(path)
27
- version = File.foreach(path) { |line| break line if $. == 4 }
28
- version.scan(/\d+/)[0].to_i
29
- end
30
-
31
- def default_theme(name)
32
- File.join(EXAMPLES_ROOT, name)
33
- end
34
-
35
- def local_theme(name)
36
- File.join(THEME_DIR, name)
37
- end
38
-
39
- def pathify_theme(name)
40
- File.join(THEME_DIR, "#{ name }.prytheme")
41
- end
42
-
43
- def fetch_collection(path, &block)
44
- uri = URI.parse(COLLECTION + path)
45
- http = Net::HTTP.new(uri.host, uri.port)
46
- http.use_ssl = true
47
-
48
- yield(http, uri)
49
- end
50
-
51
- def ansi?(color)
52
- if color.to_s =~ /\A(\d{1,3})\z/
53
- (0..255).include?(color.to_i)
54
- else
55
- false
56
- end
57
- end
58
-
59
- def rgb?(color)
60
- rgb_pattern = /
61
- \A
62
-
63
- ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])
64
- ,
65
- ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])
66
- ,
67
- ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])
68
-
69
- \z
70
- /x
71
- color =~ rgb_pattern ? true : false
72
- end
73
-
74
- def hex?(color)
75
- color =~ /\A#?[A-F\d]{6}\z/i ? true : false
76
- end
77
-
78
- def display_header(text, out)
79
- safe_width = 80
80
-
81
- out.puts "-" * safe_width
82
- out.puts make_bold(text.center(safe_width))
83
- out.puts "-" * safe_width
84
- end
85
-
86
- end
87
- end