rmthemegen 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. data/.project +18 -0
  2. data/bin/geanyfy.rb +4 -41
  3. data/lib/rmthemegen/basis_theme.tmTheme +971 -0
  4. data/lib/rmthemegen/geany.filetypes.all +2945 -0
  5. data/lib/rmthemegen/plist.html +246 -0
  6. data/lib/rmthemegen/plist_to_tokenlist.rb +242 -0
  7. data/lib/rmthemegen/rmtg_rubymine.rb +196 -0
  8. data/lib/rmthemegen/rmtg_textmate.rb +262 -0
  9. data/lib/rmthemegen/rmthemegen_187.rb +32 -233
  10. data/lib/rmthemegen/rmthemegen_parent.rb +235 -0
  11. data/lib/rmthemegen/rmthemegen_to_css.rb +1 -0
  12. data/lib/rmthemegen/syntaxes/Apache.plist +544 -0
  13. data/lib/rmthemegen/syntaxes/Bibtex.plist +406 -0
  14. data/lib/rmthemegen/syntaxes/Blog___HTML__.plist +88 -0
  15. data/lib/rmthemegen/syntaxes/Blog___Markdown__.plist +89 -0
  16. data/lib/rmthemegen/syntaxes/Blog___Text__.plist +74 -0
  17. data/lib/rmthemegen/syntaxes/Blog___Textile__.plist +74 -0
  18. data/lib/rmthemegen/syntaxes/C.plist +1126 -0
  19. data/lib/rmthemegen/syntaxes/CSS.plist +543 -0
  20. data/lib/rmthemegen/syntaxes/C____.plist +521 -0
  21. data/lib/rmthemegen/syntaxes/ClojureRepl.plist +40 -0
  22. data/lib/rmthemegen/syntaxes/Diff.plist +229 -0
  23. data/lib/rmthemegen/syntaxes/GroovyRepl.plist +40 -0
  24. data/lib/rmthemegen/syntaxes/HTML.plist +960 -0
  25. data/lib/rmthemegen/syntaxes/HTML___Rails__.plist +92 -0
  26. data/lib/rmthemegen/syntaxes/Haskell.plist +646 -0
  27. data/lib/rmthemegen/syntaxes/Io.plist +225 -0
  28. data/lib/rmthemegen/syntaxes/Java.plist +1156 -0
  29. data/lib/rmthemegen/syntaxes/JavaProperties.plist +70 -0
  30. data/lib/rmthemegen/syntaxes/JavaScript.plist +712 -0
  31. data/lib/rmthemegen/syntaxes/LaTeX.plist +1601 -0
  32. data/lib/rmthemegen/syntaxes/LaTeX_Beamer.plist +106 -0
  33. data/lib/rmthemegen/syntaxes/LaTeX_Log.plist +141 -0
  34. data/lib/rmthemegen/syntaxes/Lisp.plist +160 -0
  35. data/lib/rmthemegen/syntaxes/Literate_Haskell.plist +90 -0
  36. data/lib/rmthemegen/syntaxes/Makefile.plist +103 -0
  37. data/lib/rmthemegen/syntaxes/Markdown.plist +1192 -0
  38. data/lib/rmthemegen/syntaxes/Mirah.plist +22 -0
  39. data/lib/rmthemegen/syntaxes/PHP.plist +3481 -0
  40. data/lib/rmthemegen/syntaxes/PHP.xml +3481 -0
  41. data/lib/rmthemegen/syntaxes/Perl.plist +3209 -0
  42. data/lib/rmthemegen/syntaxes/Plain_text.plist +83 -0
  43. data/lib/rmthemegen/syntaxes/Processing.plist +296 -0
  44. data/lib/rmthemegen/syntaxes/Rez.plist +219 -0
  45. data/lib/rmthemegen/syntaxes/Ruby.plist +2891 -0
  46. data/lib/rmthemegen/syntaxes/RubyRepl.plist +40 -0
  47. data/lib/rmthemegen/syntaxes/Ruby_on_Rails.plist +288 -0
  48. data/lib/rmthemegen/syntaxes/SQL.plist +705 -0
  49. data/lib/rmthemegen/syntaxes/SQL___Rails__.plist +51 -0
  50. data/lib/rmthemegen/syntaxes/Shell__Unix__Generic.plist +1855 -0
  51. data/lib/rmthemegen/syntaxes/TeX.plist +246 -0
  52. data/lib/rmthemegen/syntaxes/TeX_Math.plist +132 -0
  53. data/lib/rmthemegen/syntaxes/Textile.plist +490 -0
  54. data/lib/rmthemegen/syntaxes/Vala.plist +285 -0
  55. data/lib/rmthemegen/syntaxes/XML.plist +576 -0
  56. data/lib/rmthemegen/syntaxes/XSL.plist +157 -0
  57. data/lib/rmthemegen/syntaxes/YAML.plist +467 -0
  58. data/lib/rmthemegen/textmate_themes/Active4D.tmTheme +407 -0
  59. data/lib/rmthemegen/textmate_themes/All Hallow's Eve Custom.tmTheme +273 -0
  60. data/lib/rmthemegen/textmate_themes/All Hallow's Eve.tmTheme +277 -0
  61. data/lib/rmthemegen/textmate_themes/Amy.tmTheme +557 -0
  62. data/lib/rmthemegen/textmate_themes/BBEdit.tmTheme +437 -0
  63. data/lib/rmthemegen/textmate_themes/Black Pearl II.tmTheme +496 -0
  64. data/lib/rmthemegen/textmate_themes/Black Pearl.tmTheme +400 -0
  65. data/lib/rmthemegen/textmate_themes/Blackboard Black.tmTheme +350 -0
  66. data/lib/rmthemegen/textmate_themes/Blackboard.tmTheme +350 -0
  67. data/lib/rmthemegen/textmate_themes/Bongzilla.tmTheme +223 -0
  68. data/lib/rmthemegen/textmate_themes/Brilliance Black.tmTheme +2619 -0
  69. data/lib/rmthemegen/textmate_themes/Brilliance Dull.tmTheme +2243 -0
  70. data/lib/rmthemegen/textmate_themes/CSSEdit.tmTheme +203 -0
  71. data/lib/rmthemegen/textmate_themes/Clouds Midnight.tmTheme +361 -0
  72. data/lib/rmthemegen/textmate_themes/Clouds.tmTheme +348 -0
  73. data/lib/rmthemegen/textmate_themes/Cobalt.tmTheme +559 -0
  74. data/lib/rmthemegen/textmate_themes/Coda.tmTheme +313 -0
  75. data/lib/rmthemegen/textmate_themes/Cool Glow.tmTheme +350 -0
  76. data/lib/rmthemegen/textmate_themes/Dawn.tmTheme +437 -0
  77. data/lib/rmthemegen/textmate_themes/Django (Smoothy).tmTheme +453 -0
  78. data/lib/rmthemegen/textmate_themes/Django.tmTheme +436 -0
  79. data/lib/rmthemegen/textmate_themes/Eiffel.tmTheme +439 -0
  80. data/lib/rmthemegen/textmate_themes/Emacs Strict.tmTheme +241 -0
  81. data/lib/rmthemegen/textmate_themes/Espresso Libre.tmTheme +402 -0
  82. data/lib/rmthemegen/textmate_themes/Espresso Tutti.tmTheme +392 -0
  83. data/lib/rmthemegen/textmate_themes/Espresso.tmTheme +329 -0
  84. data/lib/rmthemegen/textmate_themes/Fade to Grey.tmTheme +308 -0
  85. data/lib/rmthemegen/textmate_themes/Fluidvision.tmTheme +443 -0
  86. data/lib/rmthemegen/textmate_themes/ForLaTeX.tmTheme +214 -0
  87. data/lib/rmthemegen/textmate_themes/Freckle.tmTheme +279 -0
  88. data/lib/rmthemegen/textmate_themes/Friendship Bracelet.tmTheme +303 -0
  89. data/lib/rmthemegen/textmate_themes/GitHub.tmTheme +653 -0
  90. data/lib/rmthemegen/textmate_themes/GlitterBomb.tmTheme +387 -0
  91. data/lib/rmthemegen/textmate_themes/Happy happy joy joy 2.tmTheme +841 -0
  92. data/lib/rmthemegen/textmate_themes/IDLE.tmTheme +235 -0
  93. data/lib/rmthemegen/textmate_themes/IR_Black.tmTheme +810 -0
  94. data/lib/rmthemegen/textmate_themes/IR_White.tmTheme +792 -0
  95. data/lib/rmthemegen/textmate_themes/LAZY.tmTheme +291 -0
  96. data/lib/rmthemegen/textmate_themes/Lowlight.tmTheme +605 -0
  97. data/lib/rmthemegen/textmate_themes/Mac Classic.tmTheme +450 -0
  98. data/lib/rmthemegen/textmate_themes/Made of Code.tmTheme +695 -0
  99. data/lib/rmthemegen/textmate_themes/MagicWB (Amiga).tmTheme +376 -0
  100. data/lib/rmthemegen/textmate_themes/Merbivore Soft.tmTheme +285 -0
  101. data/lib/rmthemegen/textmate_themes/Merbivore.tmTheme +285 -0
  102. data/lib/rmthemegen/textmate_themes/Monokai.tmTheme +289 -0
  103. data/lib/rmthemegen/textmate_themes/MultiMarkdown.tmTheme +183 -0
  104. data/lib/rmthemegen/textmate_themes/Pastels on Dark.tmTheme +701 -0
  105. data/lib/rmthemegen/textmate_themes/Pastie.tmTheme +321 -0
  106. data/lib/rmthemegen/textmate_themes/Putty.tmTheme +275 -0
  107. data/lib/rmthemegen/textmate_themes/RDark.tmTheme +235 -0
  108. data/lib/rmthemegen/textmate_themes/Rails Envy.tmTheme +299 -0
  109. data/lib/rmthemegen/textmate_themes/Railscasts.tmTheme +278 -0
  110. data/lib/rmthemegen/textmate_themes/Ryan Light.tmTheme +232 -0
  111. data/lib/rmthemegen/textmate_themes/Slush & Poppies.tmTheme +336 -0
  112. data/lib/rmthemegen/textmate_themes/Smoothy.tmTheme +623 -0
  113. data/lib/rmthemegen/textmate_themes/SpaceCadet.tmTheme +212 -0
  114. data/lib/rmthemegen/textmate_themes/Spectacular.tmTheme +436 -0
  115. data/lib/rmthemegen/textmate_themes/Starlight.tmTheme +111 -0
  116. data/lib/rmthemegen/textmate_themes/Summer Camp Mod.tmTheme +229 -0
  117. data/lib/rmthemegen/textmate_themes/Summer Camp.tmTheme +229 -0
  118. data/lib/rmthemegen/textmate_themes/Sunburst.tmTheme +665 -0
  119. data/lib/rmthemegen/textmate_themes/Swyphs II.tmTheme +306 -0
  120. data/lib/rmthemegen/textmate_themes/Tango.tmTheme +450 -0
  121. data/lib/rmthemegen/textmate_themes/Text Ex Machina.tmTheme +295 -0
  122. data/lib/rmthemegen/textmate_themes/Tubster.tmTheme +280 -0
  123. data/lib/rmthemegen/textmate_themes/Twilight.tmTheme +518 -0
  124. data/lib/rmthemegen/textmate_themes/Vibrant Fin.tmTheme +447 -0
  125. data/lib/rmthemegen/textmate_themes/Vibrant Ink.tmTheme +447 -0
  126. data/lib/rmthemegen/textmate_themes/Vibrant Tango.tmTheme +438 -0
  127. data/lib/rmthemegen/textmate_themes/WhysPoignant.tmTheme +191 -0
  128. data/lib/rmthemegen/textmate_themes/Zenburnesque.tmTheme +343 -0
  129. data/lib/rmthemegen/textmate_themes/[ Argonaut ].tmTheme +387 -0
  130. data/lib/rmthemegen/textmate_themes/choco.tmTheme +542 -0
  131. data/lib/rmthemegen/textmate_themes/fake.tmTheme +669 -0
  132. data/lib/rmthemegen/textmate_themes/iLife 05.tmTheme +619 -0
  133. data/lib/rmthemegen/textmate_themes/iPlastic.tmTheme +286 -0
  134. data/lib/rmthemegen/textmate_themes/idleFingers.tmTheme +380 -0
  135. data/lib/rmthemegen/textmate_themes/krTheme.tmTheme +551 -0
  136. data/lib/rmthemegen/textmate_themes/monoindustrial.tmTheme +451 -0
  137. data/lib/rmthemegen/token_list.rb +171 -101
  138. data/lib/rmthemegen/uv_addons.rb +176 -0
  139. data/rmthemegen.gemspec +4 -1
  140. data/spec/rmthemegen/plist_to_tokenlist_spec.rb +0 -0
  141. data/test/choco.css +138 -0
  142. data/test/choco.render +136 -0
  143. data/test/get_tm_scopes.rb +79 -0
  144. data/test/get_tm_tokens.rb +0 -3
  145. data/test/newtheme.sh +6 -0
  146. data/test/output +14 -0
  147. data/test/rexml.element.methods +100 -0
  148. data/test/scopes_harvested +61 -0
  149. data/test/scopes_harvested.rb +15 -0
  150. data/test/test_generate_themes.rb +75 -38
  151. metadata +198 -13
  152. data/lib/rmthemegen/index.html +0 -2
  153. data/lib/rmthemegen/rmthemegen_187_textmate.rb +0 -155
  154. data/test/rmt_beautiful_quality.tmTheme +0 -399
  155. data/test/rmt_beautiful_quality.xml +0 -2089
@@ -0,0 +1,196 @@
1
+ #**********************************************************************
2
+ #* *
3
+ #* RmThemeGen - a ruby script to create random, usable themes for *
4
+ #* text editors. Currently supports RubyMine 3.X.X *
5
+ #* *
6
+ #* By David Heitzman, 2011 *
7
+ #* *
8
+ #**********************************************************************
9
+
10
+ #this is a version of the software that should work with ruby 1.8.7
11
+
12
+
13
+
14
+ require File.dirname(__FILE__)+'/rmthemegen_parent'
15
+
16
+ module RMThemeGen
17
+
18
+ class ThemeRubyMine < RMThemeParent
19
+
20
+ attr_reader :xml_save
21
+ attr_reader :xmlout #a huge structure of xml that can be given to XmlSimple.xml_out() to create that actual color theme file
22
+
23
+ def initialize
24
+ super
25
+ #"EFFECT-TYPE" s:
26
+ # 3 ==> cross-out
27
+ # 1 ==> underline
28
+ # 2 == >squiggle underline
29
+ # 5 => blockey underline
30
+ # 0 ==> box around word
31
+ # -1 ==> seems to have no effect
32
+
33
+ # if the element name contains a string from the following arrays it makes that element
34
+ # eligible for bold, italic or both. This allows elements from multiple languages to all
35
+ # be exposed equally to
36
+ # underline not implemented yet. There are several font decorations in rubymine,
37
+ # probably should be used sparingly.
38
+ @bold_chance = 0.4
39
+ @underline_chance = 0.3
40
+ @italic_candidates = ["STRING", "SYMBOL", "REQUIRE"]
41
+ @bold_candidates = ["KEYWORD","RUBY_SPECIFIC_CALL", "CONSTANT", "COMMA", "PAREN","RUBY_ATTR_ACCESSOR_CALL", "RUBY_ATTR_READER_CALL" ,"RUBY_ATTR_WRITER_CALL", "IDENTIFIER"]
42
+ # with code inspections we don't color the text, we just put a line or something under it .
43
+ @code_inspections = ["ERROR","WARNING_ATTRIBUTES","DEPRECATED", "TYPO","WARNING_ATTRIBUTES", "BAD_CHARACTER",
44
+ "CUSTOM_INVALID_STRING_ESCAPE_ATTRIBUTES","ERRORS_ATTRIBUTES", "MATCHED_BRACE_ATTRIBUTES"]
45
+ @cross_out = ["DEPRECATED_ATTRIBUTES" ]
46
+
47
+ @unders = %w(-1 0 1 2 5 )
48
+ @underline_candidates = ["STRING"]
49
+ @italic_chance = 0.2
50
+ end
51
+
52
+ def set_doc_colors
53
+ newopt = []
54
+ @@doc_color_keys.each do |o|
55
+ if o == "CARET_ROW_COLOR" then
56
+ @caret_row_color = randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.05,:max_cont => 0.08,:shade_of_grey=>false)
57
+ newopt << {:name=> o, :value => @caret_row_color }
58
+ @document_globals[:CARET_ROW_COLOR] = @caret_row_color
59
+ elsif o.include?("SELECTION_BACKGROUND") then
60
+ @selection_background = randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.07,:max_cont => 0.09,:shade_of_grey=>false)
61
+ newopt << {:name=> o, :value => @selection_background }
62
+ @document_globals[:SELECTION_BACKGROUND] = @selection_background
63
+ elsif o.include?("SELECTION_FOREGROUND") then
64
+ newopt << {:name=> o }
65
+ elsif o.include?("GUTTER_BACKGROUND") then
66
+ newopt << {:name=> o, :value => @backgroundcolor }
67
+ elsif o.include?("CARET_COLOR") then
68
+ newopt << {:name=> o, :value => (@caret_color = randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.30,:max_cont=>0.7,:shade_of_grey=>true) )}
69
+ @document_globals[:CARET_COLOR] = @caret_color
70
+ elsif o.include?("READONLY_BACKGROUND") then
71
+ newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.03,:max_cont=>0.09,:shade_of_grey=>@background_grey) }
72
+ elsif o.include?("READONLY_FRAGMENT_BACKGROUND") then
73
+ newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.03,:max_cont=>0.09,:shade_of_grey=>@background_grey) }
74
+ elsif o.include?("INDENT_GUIDE") then
75
+ newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.08,:max_cont=>0.22,:shade_of_grey=>@background_grey) }
76
+ else
77
+ newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>@min_cont,:max_cont=>@max_cont,:shade_of_grey=>@background_grey).to_s }
78
+ end
79
+ end
80
+
81
+ @xmlout[:scheme][0][:colors][0][:option] = newopt
82
+ end
83
+
84
+ def set_doc_options
85
+ newopt = []
86
+ newopt << {:name => "LINE_SPACING",:value=>'1.0' } #:value=>'1.3' works all right
87
+ newopt << {:name => "EDITOR_FONT_NAME",:value => "DejaVu Sans Mono" }
88
+ newopt << {:name => "EDITOR_FONT_SIZE",:value => "12"} #:value = "14" is a safe default if you want to specify something
89
+ newopt << {:name => "RANDOM_SEED",:value => @random_seed.to_s }
90
+ @xmlout[:scheme][0][:option] = newopt
91
+ end
92
+
93
+ def set_element_colors
94
+ newopt = []
95
+ newopt[0]={:option=>[]}
96
+ ################ set the fonttype
97
+ @@element_keys.each do |o|
98
+ fonttype = 0 #bold: 1, #italic: 2, bold & italic: 3
99
+ @bold_candidates.each do |bc|
100
+ if o.include? bc.to_s then
101
+ if rand < @bold_chance then fonttype = 1 end
102
+ end
103
+ end
104
+ @italic_candidates.each do |ic|
105
+ if o.include? ic.to_s then
106
+ if rand < @italic_chance then fonttype += 2 end
107
+ end
108
+ end
109
+ #this block is for setting up special cases for the new color - ie, comments darker,
110
+ #reserved words are yellowins, whatever
111
+ fonttype = "" unless fonttype.is_a? Fixnum
112
+ case
113
+ when o.include?( "COMMENT")
114
+ #comments -- this is done so that COMMENTED texts skew toward darker shades.
115
+ newcol = randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.25, :max_cont => 0.27)
116
+ optblj=[{:option=>[ {:name => "FOREGROUND", :value => newcol},
117
+ # {:name => "BACKGROUND", :value =>@backgroundcolor},
118
+ {:name => "BACKGROUND"},
119
+ {:name => "EFFECT_COLOR" },{:name => "FONT_TYPE", :value=>fonttype.to_s },
120
+ {:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor) }]}]
121
+ #default text and background for whole document
122
+ when ["TEXT","FOLDED_TEXT_ATTRIBUTES"].include?( o.to_s)
123
+ newcol = randcolor(:bg_rgb=>@backgroundcolor )
124
+ optblj=[{:option=>[ {:name => "FOREGROUND", :value => newcol},
125
+ {:name => "BACKGROUND", :value =>@backgroundcolor},
126
+ {:name => "EFFECT_COLOR" },{:name => "FONT_TYPE", :value=>fonttype.to_s },
127
+ {:name => "ERROR_STRIPE_COLOR", :value => (randcolor(:bg_rgb=>@backgroundcolor) ) }]}]
128
+ @document_globals[:TEXT] = newcol
129
+ when @code_inspections.include?(o.to_s)
130
+ newcol = randcolor(:bg_rgb=>@backgroundcolor)
131
+ optblj=[{:option=>[ {:name => "FOREGROUND"},
132
+ {:name => "BACKGROUND"},
133
+ {:name => "EFFECT_COLOR", :value =>newcol},{:name => "FONT_TYPE", :value=>fonttype.to_s },
134
+ {:name => "EFFECT_TYPE", :value=>@unders.shuffle[0].to_s },
135
+ {:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor) }]}]
136
+ when @cross_out.include?(o.to_s)
137
+ newcol = randcolor(:bg_rgb=>@backgroundcolor)
138
+ optblj=[{:option=>[ {:name => "FOREGROUND"},
139
+ {:name => "BACKGROUND"},
140
+ {:name => "EFFECT_COLOR", :value =>newcol},{:name => "FONT_TYPE", :value=>fonttype.to_s },
141
+ {:name => "EFFECT_TYPE", :value=>"3" },
142
+ {:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor)}]}]
143
+ else
144
+ newcol=randcolor(:bg_rgb=>@backgroundcolor)
145
+ optblj=[{:option=>[ {:name => "FOREGROUND", :value => newcol},
146
+ {:name => "BACKGROUND"},
147
+ {:name => "EFFECT_COLOR" },{:name => "FONT_TYPE", :value=>fonttype.to_s },
148
+ {:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor) }]}]
149
+ end
150
+ newopt[0][:option] << {:name =>o.to_s , :value=>optblj}
151
+ tmphash = {}
152
+ optblj[0][:option].each do |siing|
153
+ tmphash[ siing[:name].to_sym ] = siing[:value]
154
+ end
155
+ @textmate_hash[o.to_sym] = tmphash
156
+ end
157
+
158
+ @xmlout[:scheme][0][:attributes] = newopt
159
+ end
160
+
161
+ def make_theme_file(outputdir = ENV["PWD"], bg_color_style=:dark, colorsets=[], rand_seed=nil)
162
+ make_rm_theme_file(outputdir, bg_color_style, colorsets, rand_seed)
163
+ end
164
+
165
+ # (output directory, bg_color_style, colorsets [])
166
+ def make_rm_theme_file(outputdir = ENV["PWD"], bg_color_style=:dark, colorsets=[], rand_seed=nil)
167
+ #bg_color_style: 0 = blackish, 1 = whitish, 2 = any color, from #000000 to #FFFFFF
168
+ handle_rand_seed(rand_seed)
169
+ @theme_successfully_created=false
170
+ before_create(outputdir, bg_color_style, colorsets, rand_seed)
171
+ @xmlout = {:scheme=>
172
+ [{
173
+ :attributes => [{:option=>[
174
+ {:name=>"2ABSTRACT_CLASS_NAME_ATTRIBUTES", :value=>[{:option=>{:name=>"foreground",:value=>"red"}}] },
175
+ {:name=>"4ABSTRACT_CLASS_NAME_ATTRIBUTES", :value=>[{:option=>{:name=>"foreground",:value=>"red"}}] }
176
+ ]
177
+ }],
178
+ :colors => [{ :option => [{:name=>"foreground",:value => "yellow"},{:name=>"background",:value => "black"} ],
179
+ :option =>[{:name=>"pencil length",:value=>"48 cm"},{:name => "Doowop level", :value=>"medium"}]
180
+ }],
181
+ :name => @themename,:version=>@themeversion,:parent_scheme=>"Default", :author=>"David Heitzman, http://rmthemegen.com"
182
+ }]
183
+ }
184
+ @savefile = randfilename(@themename)
185
+ @outf = File.new(@opts[:outputdir]+"/"+@savefile, "w+")
186
+ set_element_colors
187
+ set_doc_colors
188
+ set_doc_options
189
+ XmlSimple.xml_out(@xmlout,{:keeproot=>true,:xmldeclaration=>true,:outputfile=> @outf, :rootname => "scheme"})
190
+ @outf.close
191
+ @theme_successfully_created = true
192
+ return File.expand_path(@outf.path)
193
+ end
194
+
195
+ end #class
196
+ end #module
@@ -0,0 +1,262 @@
1
+ #**********************************************************************
2
+ #* *
3
+ #* RmThemeGen - a ruby script to create random, usable themes for *
4
+ #* text editors. Currently supports RubyMine 3.X.X *
5
+ #* *
6
+ #* By David Heitzman, 2011 *
7
+ #* *
8
+ #**********************************************************************
9
+
10
+ #this is a version of the software that should work with ruby 1.8.7
11
+
12
+ require File.dirname(__FILE__)+'/rmthemegen_parent'
13
+
14
+ module RMThemeGen
15
+ class ThemeTextmate < RMThemeParent
16
+
17
+ def unique_number(n=-1)
18
+ @unique_num ||= n
19
+ @unique_num += 1
20
+ @unique_num
21
+ end
22
+
23
+ def initialize
24
+ super
25
+ @bold_chance = 0.4
26
+ @underline_chance = 0.3
27
+ @italic_candidates = []
28
+ @bold_candidates = []
29
+ # with code inspections we don't color the text, we just put a line or something under it .
30
+ @code_inspections = []
31
+ @cross_out = [ ]
32
+
33
+ @underline_candidates = []
34
+ @italic_chance = 0.2
35
+ end
36
+
37
+ def set_doc_options(dd)
38
+ @document_globals[:backgroundcolor]=@backgroundcolor
39
+ @document_globals[:caret_color]= randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.30,:max_cont=>0.7,:shade_of_grey=>true)
40
+ @document_globals[:text]=randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.24,:max_cont=>0.7,:shade_of_grey=>false) #TEXT should hardly ever appears, since every possible color is stipulated
41
+ @document_globals[:caret_row_color] = randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.05,:max_cont => 0.08,:shade_of_grey=>false)
42
+ @document_globals[:selection_background] = randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.07,:max_cont => 0.09,:shade_of_grey=>false)
43
+
44
+ dd.add_element(
45
+ make_dict(
46
+ :background=>"#"+@document_globals[:backgroundcolor].upcase,
47
+ :caret=>"#"+ @document_globals[:caret_color].upcase ,
48
+ :foreground=>"#"+@document_globals[:text].upcase,
49
+ :invisibles=>"#"+@document_globals[:backgroundcolor].upcase,
50
+ :lineHighlight=>"#"+@document_globals[:caret_row_color].upcase,
51
+ :selection=>"#"+@document_globals[:selection_background].upcase
52
+ )
53
+ )
54
+ end
55
+
56
+ #subclass
57
+ def before_create(outputdir, bg_color_style, colorsets, rand_seed)
58
+ super(outputdir, bg_color_style, colorsets, rand_seed)
59
+
60
+ end
61
+
62
+ def set_doc_colors
63
+
64
+ end
65
+
66
+ def set_element_colors
67
+ end
68
+
69
+
70
+ def make_theme_from_hash
71
+
72
+ end
73
+
74
+ def make_theme_file(outputdir = ENV["PWD"], bg_color_style=:dark, colorsets=[], rand_seed=nil)
75
+ create_textmate_theme(outputdir, bg_color_style, colorsets, rand_seed)
76
+ end
77
+
78
+ def create_textmate_theme(outputdir = ENV["PWD"], bg_color_style=:dark, colorsets=[], rand_seed=nil, opts_hash={})
79
+ opts_hash[:punctuation_bold] = 0.2
80
+ opts_hash[:backgrounds_colored] = 0.05
81
+
82
+
83
+ #returns path to file that it created, which is an xml file that should work in textmate.
84
+ handle_rand_seed(rand_seed)
85
+ before_create(outputdir, bg_color_style, colorsets, rand_seed)
86
+ #it will save the theme file ".tmTheme" in the same directory as other themes
87
+ #it will return the full name and path of that theme file.
88
+
89
+ @theme_successfully_created=false
90
+ @savefile = "rmt_"+@themename+".tmTheme"
91
+ @outf = File.new(@opts[:outputdir]+"/"+@savefile, "w+")
92
+ rexmlout = REXML::Document.new
93
+ rexmlout << REXML::DocType.new('plist','PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"')
94
+ rexmlout << REXML::XMLDecl.new("1.0","UTF-8",nil)
95
+ plist = REXML::Element.new "plist"
96
+ plist.add_attributes( "version"=>"1.0")
97
+ dict = REXML::Element.new( "dict", plist) #causes plist to be the parent of dict
98
+ dict.add_text(REXML::Element.new("key").add_text("name") )
99
+ dict.add_text(REXML::Element.new("string").add_text( @themename ) )
100
+ dict.add_text(REXML::Element.new("key").add_text("author") )
101
+ dict.add_text(REXML::Element.new("string").add_text("David Heitzman") )
102
+ dict.add_text(REXML::Element.new("key").add_text("settings") )
103
+ main_array = REXML::Element.new("array",dict)
104
+ doc_dict = REXML::Element.new("dict",main_array)
105
+ doc_dict.add_text(REXML::Element.new("key").add_text("settings") )
106
+
107
+ set_doc_options(doc_dict)
108
+
109
+ process_plists()
110
+
111
+ scopes_found=get_scopes_from_themefiles()
112
+ co2 =0
113
+ @used_names ={}
114
+
115
+ #group_2_color.each do |g,c| group_2_color[g] = "#"+randcolor(:bg_rgb=>@backgroundcolor).upcase end
116
+
117
+ @new_color_to_group = {} #so this will have a key from each color to its group and also a key for each scope to its color
118
+ @color_2_group.each do |c,g|
119
+ fontStyle=''
120
+ if g.join(' ').upcase.include?( "ITALIC" ) || rand < (@italic_chance/2)
121
+ fontStyle +="italic "
122
+ end
123
+ if g.join(' ').upcase.include?( "BOLD" ) || rand < (@bold_chance/2)
124
+ fontStyle += "bold "
125
+ end
126
+ newcol = "#"+randcolor(:bg_rgb=>@backgroundcolor).upcase
127
+ @new_color_to_group[newcol] = color_2_group[c]
128
+
129
+ g.each do |s|
130
+ @new_color_to_group[s] = {:foreground=>newcol,:fontStyle=>fontStyle.chop!}
131
+ end
132
+ end
133
+
134
+ scopes_found.each_index do |k|
135
+ v=scopes_found[k]
136
+ if self.scopes_found_count[v] > 0
137
+ scope_text = v
138
+ scope_text = scope_text.split(",")[0] if v.include?(",")
139
+ scope_text = scope_text.split[0].split(".") #this takes the first whole token prior to any spaces, then makes the array out of the substrings separated by periods
140
+ elname = " ~ "+scope_text[0] || " ! "+unique_number.to_s
141
+ co=1
142
+ while !@used_names[elname].nil?
143
+ if scope_text[co]
144
+ elname += "."+scope_text[co]
145
+ else
146
+ elname += unique_number.to_s
147
+ end
148
+ co += 1
149
+ end
150
+ # puts 'rmtg_textmate:131 '+elname
151
+ # puts 'the scope that kills it: "'+v.to_s
152
+ # elname = "uniquename"+unique_number.to_s
153
+ @used_names[elname] = true
154
+ main_array.add_element(
155
+ # so it's make_name_scope_settings_rand(name,scope,[don't worry about it, but colors you can assign manually])
156
+ make_name_scope_settings_rand(elname,v,[])
157
+ )
158
+ co2 += 1
159
+ end
160
+ end
161
+
162
+ # variable.other.readwrite.instance.ruby
163
+ # variable.other.readwrite.class.ruby
164
+
165
+ uuid_key = REXML::Element.new("key")
166
+ uuid_key.add_text("uuid")
167
+ uuid_element = REXML::Element.new("string")
168
+ uuid_element.add_text( gen_uuid)
169
+ dict.add_element uuid_key
170
+ dict.add_element uuid_element
171
+
172
+ rexmlout << plist
173
+ formatter = REXML::Formatters::Pretty.new
174
+ formatter.compact=true
175
+
176
+ formatter.write(rexmlout, @outf)
177
+ @outf.close
178
+ @theme_successfully_created = true
179
+ return File.expand_path(@outf.path)
180
+ end
181
+
182
+
183
+
184
+ def make_dict(a_hash)
185
+ new_dict = REXML::Element.new("dict")
186
+ a_hash.each do |k,v|
187
+ te1 = REXML::Element.new("key")
188
+ te1.add_text(k.to_s)
189
+ te2 = REXML::Element.new("string")
190
+ te2.add_text(v.to_s)
191
+ new_dict.add_element te1
192
+ new_dict.add_element te2
193
+ end
194
+ return new_dict
195
+ end
196
+
197
+ def make_name_scope_settings(ruby_symbol,an_array)
198
+ fontstyles = ["","bold","italic", "bold italic"]
199
+ #the array looks like ["name","scope",{}] . the third element in the array is a hash for "settings"
200
+ new_dict = REXML::Element.new("dict")
201
+ te1 = REXML::Element.new("key")
202
+ te1.add_text("name")
203
+ te2 = REXML::Element.new("string")
204
+ te2.add_text(an_array[0])
205
+ te3 = REXML::Element.new("key")
206
+ te3.add_text("scope")
207
+ te4 = REXML::Element.new("string")
208
+ te4.add_text(an_array[1])
209
+ te5 = REXML::Element.new("key")
210
+ te5.add_text("settings")
211
+ new_dict.add_element te1
212
+ new_dict.add_element te2
213
+ new_dict.add_element te3
214
+ new_dict.add_element te4
215
+ new_dict.add_element te5
216
+ fontStyle = fontstyles[@textmate_hash[ruby_symbol][:FONT_TYPE].to_i ]
217
+ di1 = make_dict(:foreground => "#"+@textmate_hash[ruby_symbol][:FOREGROUND].upcase, :fontStyle=>fontStyle)
218
+ new_dict.add_element di1
219
+ return new_dict
220
+ end
221
+
222
+ def make_name_scope_settings_rand(name, scope, settings)
223
+ fontstyles = ["","bold","italic", "bold italic"]
224
+ #the array looks like ["name","scope",{}] . the third element in the array is a hash for "settings"
225
+ new_dict = REXML::Element.new("dict")
226
+ te1 = REXML::Element.new("key")
227
+ te1.add_text("name")
228
+ te2 = REXML::Element.new("string")
229
+ te2.add_text(name.to_s)
230
+ te3 = REXML::Element.new("key")
231
+ te3.add_text("scope")
232
+ te4 = REXML::Element.new("string")
233
+ te4.text =scope.to_s
234
+ te5 = REXML::Element.new("key")
235
+ te5.add_text("settings")
236
+ new_dict.add_element te1
237
+ new_dict.add_element te2
238
+ new_dict.add_element te3
239
+ new_dict.add_element te4
240
+ new_dict.add_element te5
241
+
242
+ #puts "scope= #{scope} , group= #{@scope_2_group[scope]} , newcolor = "+newcolor.to_s
243
+
244
+ if @new_color_to_group[scope]
245
+ puts "scope= #{scope} , group= #{@scope_2_group[scope]} , newcolor = "+@new_color_to_group[scope][:foreground]+ " , fonStyle=#{@new_color_to_group[scope][:fontStyle]}"
246
+ di1 = make_dict(@new_color_to_group[scope])
247
+ else
248
+ di1 = make_dict(:fontStyle=>'')
249
+ end
250
+ new_dict.add_element di1
251
+ return new_dict
252
+ end
253
+
254
+ def gen_uuid
255
+ nn = sprintf("%032X",rand(340282366920938463463374607431768211456).abs)
256
+ nn = nn[0,8]+"-"+nn[12,4]+"-4"+nn[17,3]+"-"+["8","9","A","B"].shuffle[0]+nn[21,3]+"-"+nn[24,12]
257
+ end
258
+
259
+ end #class
260
+
261
+
262
+ end #module