rmthemegen 0.0.7 → 0.0.8
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.
- data/lib/rmthemegen/generate_themes.rb +29 -0
- data/lib/rmthemegen/rmthemegen_187.rb +10 -25
- data/lib/rmthemegen/version.rb +1 -1
- data/lib/rmthemegen.rb +1 -7
- data/rmthemegen.gemspec +1 -1
- metadata +4 -4
- data/lib/rmthemegen/rmthemegen.rb +0 -357
@@ -0,0 +1,29 @@
|
|
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
|
+
#originally it was written and tested for ruby 1.9.2
|
12
|
+
|
13
|
+
|
14
|
+
require File.dirname(__FILE__)+'/rmthemegen_187'
|
15
|
+
|
16
|
+
|
17
|
+
puts "rmthemegen - creates theme files for use with rubymine (3.0.0 and up) "
|
18
|
+
puts "by David Heitzman 2011 "
|
19
|
+
|
20
|
+
puts "generating themes into current directory. Filenames: rmt_xyz.xml "
|
21
|
+
|
22
|
+
l = RMThemeGen::ThemeGenerator.new
|
23
|
+
|
24
|
+
@iterations = ARGV[0] || 1
|
25
|
+
@iterations = @iterations.to_i
|
26
|
+
|
27
|
+
@iterations.times do
|
28
|
+
puts l.make_theme_file
|
29
|
+
end
|
@@ -28,12 +28,6 @@ module RMThemeGen
|
|
28
28
|
|
29
29
|
@iterations = 1
|
30
30
|
@iterations = ARGV[0].to_s.to_i if ARGV[0]
|
31
|
-
|
32
|
-
puts "rmthemegen - creates theme files for use with rubymine (3.0.0 and up) "
|
33
|
-
puts "by David Heitzman 2011 "
|
34
|
-
puts (@@adjectives.size * @@nouns.size).to_s + " possible theme names "
|
35
|
-
|
36
|
-
puts "generating #{@iterations.to_s} themes into current directory. Filenames: rmt_xyz.xml "
|
37
31
|
#bold: <option name="FONT_TYPE" value="1" />
|
38
32
|
#italic: <option name="FONT_TYPE" value="2" />
|
39
33
|
#bold & italic: <option name="FONT_TYPE" value="3" />
|
@@ -282,10 +276,7 @@ module RMThemeGen
|
|
282
276
|
f.close
|
283
277
|
end
|
284
278
|
|
285
|
-
def
|
286
|
-
# @default_fg = @backgroundcolor
|
287
|
-
# puts "backgroundcolor = "+@backgroundcolor
|
288
|
-
@iterations.times do
|
279
|
+
def make_theme_file(outputdir = File.dirname(__FILE__) )
|
289
280
|
@backgroundcolor= randcolor(:shade_of_grey=>@background_grey, :max_bright=>@background_max_brightness)# "0"
|
290
281
|
@schemename = randthemename
|
291
282
|
@xmlout = {:scheme=>
|
@@ -299,23 +290,17 @@ module RMThemeGen
|
|
299
290
|
}]
|
300
291
|
}]
|
301
292
|
}
|
302
|
-
|
303
|
-
@outf = File.new(
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
#
|
309
|
-
|
310
|
-
|
311
|
-
@outf.close
|
312
|
-
# puts "making geany directory "+make_geany_files.to_s
|
313
|
-
end
|
293
|
+
@savefile = randfilename(@schemename)
|
294
|
+
@outf = File.new(outputdir+"/"+@savefile, "w+")
|
295
|
+
set_doc_options
|
296
|
+
set_doc_colors
|
297
|
+
set_element_colors
|
298
|
+
XmlSimple.xml_out(@xmlout,{:keeproot=>true,:xmldeclaration=>true,:outputfile=> @outf, :rootname => "scheme"})
|
299
|
+
# puts "outputting to file "+@savefile
|
300
|
+
@outf.close
|
301
|
+
return File.expand_path(@outf.path)
|
314
302
|
end
|
315
303
|
|
316
304
|
|
317
305
|
end #class
|
318
306
|
end #module
|
319
|
-
|
320
|
-
l = RMThemeGen::ThemeGenerator.new
|
321
|
-
l.make_theme_files
|
data/lib/rmthemegen/version.rb
CHANGED
data/lib/rmthemegen.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
1
|
module Rmthemegen
|
2
2
|
# Your code goes here...
|
3
|
-
|
4
|
-
if RUBY_VERSION == "1.8.7"
|
5
|
-
require File.dirname(__FILE__)+"/rmthemegen/rmthemegen_187.rb"
|
6
|
-
else
|
7
|
-
require File.dirname(__FILE__)+"/rmthemegen/rmthemegen.rb"
|
8
|
-
end
|
9
|
-
|
3
|
+
require File.dirname(__FILE__)+"/rmthemegen/rmthemegen_187.rb"
|
10
4
|
end
|
data/rmthemegen.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmthemegen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Heitzman
|
@@ -35,9 +35,9 @@ files:
|
|
35
35
|
- Rakefile
|
36
36
|
- lib/rmthemegen.rb
|
37
37
|
- lib/rmthemegen/geany_fix.rb
|
38
|
+
- lib/rmthemegen/generate_themes.rb
|
38
39
|
- lib/rmthemegen/rgb_contrast_methods.rb
|
39
40
|
- lib/rmthemegen/rgb_contrast_test.rb
|
40
|
-
- lib/rmthemegen/rmthemegen.rb
|
41
41
|
- lib/rmthemegen/rmthemegen_187.rb
|
42
42
|
- lib/rmthemegen/token_list.rb
|
43
43
|
- lib/rmthemegen/version.rb
|
@@ -1,357 +0,0 @@
|
|
1
|
-
require 'xmlsimple'
|
2
|
-
require 'color'
|
3
|
-
require File.dirname(__FILE__)+"/token_list"
|
4
|
-
require File.dirname(__FILE__)+'/rgb_contrast_methods'
|
5
|
-
|
6
|
-
module RMThemeGen
|
7
|
-
|
8
|
-
class ThemeGenerator < RMThemeParent
|
9
|
-
|
10
|
-
attr_reader :xmlout #a huge structure of xml that can be given to XmlSimple.xml_out() to create that actual color theme file
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@rand = Random.new
|
14
|
-
|
15
|
-
@iterations = 0
|
16
|
-
@iterations = ARGV[0].to_s.to_i
|
17
|
-
|
18
|
-
puts "rmthemegen - creates theme files for use with rubymine (3.0.0 and up) "
|
19
|
-
puts "by David Heitzman 2011 "
|
20
|
-
puts (@@adjectives.size * @@nouns.size).to_s + " possible theme names "
|
21
|
-
|
22
|
-
puts "generating #{@iterations.to_s} themes into current directory. Filenames: rmt_xyz.xml "
|
23
|
-
|
24
|
-
=begin
|
25
|
-
#for testing purposes of the RGB contrast evaluator
|
26
|
-
f = File.open("index.html","w+")
|
27
|
-
st1="<html>"
|
28
|
-
h = Hash.new
|
29
|
-
#generate histogram
|
30
|
-
0.times do
|
31
|
-
begin
|
32
|
-
grkcol = Color::RGB.new(@rand.rand*256,@rand.rand*256,@rand.rand*256)
|
33
|
-
brkcol = Color::RGB.new(@rand.rand*256,@rand.rand*256,@rand.rand*256)
|
34
|
-
#puts grkcol.contrast(brkcol)
|
35
|
-
end until true# grkcol.contrast(brkcol) > 0.20
|
36
|
-
key =(grkcol.contrast(brkcol)*100).to_i
|
37
|
-
h[key] = h.has_key?(key) ? h[key] += 1 : 1
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
0.upto 0 do |f|
|
42
|
-
st1 += "<p>"+f.to_s+": "+ ( h[f.to_i] ? h[f.to_i].to_s : "nada")+"</p>"
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
0.upto 255 do |i|
|
47
|
-
begin
|
48
|
-
# grkcol = Color::RGB.new(@rand.rand*256,@rand.rand*256,@rand.rand*256)
|
49
|
-
# brkcol = Color::RGB.new(@rand.rand*256,@rand.rand*256,@rand.rand*256)
|
50
|
-
grkcol = Color::RGB.new( 0,0,0 )
|
51
|
-
brkcol = Color::RGB.new(i,0,0)
|
52
|
-
#puts grkcol.contrast(brkcol)
|
53
|
-
end until true# grkcol.contrast(brkcol) > 0.20
|
54
|
-
st1 += "<p style='padding:0;margin:0;background-color:#{grkcol.html};color:#{brkcol.html};'>aBD9 #!#$87 asf asdf werpl 09890 asd78coiuqwe rasdu 987zxcv klj;lcv "
|
55
|
-
st1 += "<span style='padding:0;margin:0;background-color:#ffffff;color:#000000;'>hue/lum/bri/all: #{(100*grkcol.diff_hue(brkcol)).to_i}/#{(100*grkcol.diff_lum(brkcol)).to_i}/#{(100*grkcol.diff_bri(brkcol)).to_i}/#{(100*grkcol.contrast(brkcol)).to_i}</p>"
|
56
|
-
# grkcol = Color::RGB.new(0xf1,0x11,0x9a)
|
57
|
-
# brkcol = Color::RGB.new(0xa0,0xf4,0x2f)
|
58
|
-
# st1 += "<p style='padding:0;margin:0;background-color:#{grkcol.html};color:#{brkcol.html};'>aBD9 #!#$87 asf asdf werpl 09890 asd78coiuqwe rasdu 987zxcv klj;lcv "
|
59
|
-
# st1 += "<span style='padding:0;margin:0;background-color:#ffffff;color:#000000;'>hue/lum/bri/all: #{(100*grkcol.diff_hue(brkcol)).to_i}/#{(100*grkcol.diff_lum(brkcol)).to_i}/#{(100*grkcol.diff_bri(brkcol)).to_i}/#{(100*grkcol.contrast(brkcol)).to_i}</p>"
|
60
|
-
# grkcol = Color::RGB.new(0x42,0x08,0x11)
|
61
|
-
# brkcol = Color::RGB.new(0x48,0x19,0xd0)
|
62
|
-
# st1 += "<p style='background-color:#{grkcol.html};color:#{brkcol.html};'>aBD9 #!#$87 asf asdf werpl 09890 asd78coiuqwe rasdu 987zxcv klj;lcv "
|
63
|
-
#st1 += "<span style='background-color:#ffffff;color:#000000;'>hue/lum/bri/all: #{(100*grkcol.diff_hue(brkcol)).to_i}/#{(100*grkcol.diff_lum(brkcol)).to_i}/#{(100*grkcol.diff_bri(brkcol)).to_i}/#{(100*grkcol.contrast(brkcol)).to_i}</p>"
|
64
|
-
end
|
65
|
-
|
66
|
-
st1+="</html>"
|
67
|
-
printf(f,st1)
|
68
|
-
f.close
|
69
|
-
|
70
|
-
Kernel.exit
|
71
|
-
=end
|
72
|
-
|
73
|
-
#bold: <option name="FONT_TYPE" value="1" />
|
74
|
-
#italic: <option name="FONT_TYPE" value="2" />
|
75
|
-
#bold & italic: <option name="FONT_TYPE" value="3" />
|
76
|
-
|
77
|
-
#"EFFECT-TYPE" s:
|
78
|
-
# 3 ==> cross-out
|
79
|
-
# 1 ==> underline
|
80
|
-
# 2 == >squiggle underline
|
81
|
-
# 5 => blockey underline
|
82
|
-
# 0 ==> box around word
|
83
|
-
# -1 ==> seems to have no effect
|
84
|
-
|
85
|
-
# if the element name contains a string from the following arrays it makes that element
|
86
|
-
# eligible for bold, italic or both. This allows elements from multiple languages to all
|
87
|
-
# be exposed equally to
|
88
|
-
# underline not implemented yet. There are several font decorations in rubymine,
|
89
|
-
# probably should be used sparingly.
|
90
|
-
@italic_candidates = ["STRING", "SYMBOL", "REQUIRE"]
|
91
|
-
|
92
|
-
@bold_candidates = ["KEYWORD","RUBY_SPECIFIC_CALL", "CONSTANT", "COMMA", "PAREN","RUBY_ATTR_ACCESSOR_CALL", "RUBY_ATTR_READER_CALL" ,"RUBY_ATTR_WRITER_CALL", "IDENTIFIER"]
|
93
|
-
# with code inspections we don't color the text, we just put a line or something under it .
|
94
|
-
@code_inspections = ["ERROR","WARNING_ATTRIBUTES","DEPRECATED", "TYPO","WARNING_ATTRIBUTES", "BAD_CHARACTER",
|
95
|
-
"CUSTOM_INVALID_STRING_ESCAPE_ATTRIBUTES","ERRORS_ATTRIBUTES", "MATCHED_BRACE_ATTRIBUTES"]
|
96
|
-
@cross_out = ["DEPRECATED_ATTRIBUTES" ]
|
97
|
-
|
98
|
-
@unders = %w(-1 0 1 2 5 )
|
99
|
-
@underline_candidates = ["STRING"]
|
100
|
-
@italic_chance = 0.2
|
101
|
-
@bold_chance = 0.4
|
102
|
-
@underline_chance = 0.3
|
103
|
-
@bright_median = 0.85
|
104
|
-
@min_bright = @bright_median * 0.65
|
105
|
-
@max_bright = [@bright_median * 1.35,1.0].max
|
106
|
-
|
107
|
-
@min_bright = 0.0
|
108
|
-
@max_bright = 1.0
|
109
|
-
|
110
|
-
# if we avoid any notion of "brightness", which is an absolute quality, then we
|
111
|
-
# can make our background any color we want !
|
112
|
-
|
113
|
-
#tighter contrast spec
|
114
|
-
@cont_median = 0.85
|
115
|
-
@min_cont = @cont_median * 0.65
|
116
|
-
@max_cont = [@cont_median * 1.35,1.0].max
|
117
|
-
|
118
|
-
#broad contrast spec
|
119
|
-
@min_cont = 0.30
|
120
|
-
@max_cont = 1.0
|
121
|
-
|
122
|
-
@schemeversion = 1
|
123
|
-
@background_max_brightness = 0.14
|
124
|
-
@background_grey = true #if false, allows background to be any color, as long as it meets brightness parameter
|
125
|
-
# @foreground_min_brightness = 0.4
|
126
|
-
|
127
|
-
|
128
|
-
@backgroundcolor= randcolor( :shade_of_grey=>@background_grey, :max_bright=>@background_max_brightness)# "0"
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
def randthemename
|
133
|
-
out = " "
|
134
|
-
while out.include? " " do
|
135
|
-
out = @@adjectives[@rand.rand * @@adjectives.size]+"_"+@@nouns[@rand.rand * @@nouns.size]
|
136
|
-
end
|
137
|
-
return out
|
138
|
-
end
|
139
|
-
|
140
|
-
def randfilename(existing = "")
|
141
|
-
if existing != "" then
|
142
|
-
out=existing
|
143
|
-
else
|
144
|
-
ar=["a","b","f","h","z","1","5"]
|
145
|
-
ar.shuffle!
|
146
|
-
out =""
|
147
|
-
ar.each { |n|
|
148
|
-
out << n
|
149
|
-
}
|
150
|
-
end
|
151
|
-
return "rmt_"+out+".xml"
|
152
|
-
end
|
153
|
-
|
154
|
-
|
155
|
-
def randcolor(opts={})
|
156
|
-
|
157
|
-
df= { :r=>nil, :g=>nil, :b=>nil, #these are the usual 0..255
|
158
|
-
:bg_rgb => nil,
|
159
|
-
:min_cont => @min_cont, #if a backrgb (background color) is supplied this will be used to create a minimum contrast with it.
|
160
|
-
:max_cont => @max_cont,
|
161
|
-
:max_bright => @max_bright,
|
162
|
-
:min_bright => @min_bright,
|
163
|
-
# :bright_median => 0.5,
|
164
|
-
:shade_of_grey => false} #forces r == g == b
|
165
|
-
df = df.merge opts
|
166
|
-
df[:bg_rgb] = Color::RGB.from_html(df[:bg_rgb]) if df[:bg_rgb]
|
167
|
-
color = brightok = contok = nil;
|
168
|
-
while (!color || !brightok || !contok ) do
|
169
|
-
r = (df[:r] || @rand.rand*256)%256 #mod for robustness
|
170
|
-
g = (df[:g] || @rand.rand*256)%256
|
171
|
-
b = (df[:b] || @rand.rand*256)%256
|
172
|
-
g = b = r if df[:shade_of_grey] == true
|
173
|
-
color = Color::RGB.new(r,g,b)
|
174
|
-
#puts "bg" + @backgroundcolor if df[:bg_rgb]
|
175
|
-
#puts "color "+color.html
|
176
|
-
#puts "contrast "+color.contrast(df[:bg_rgb]).to_s if df[:bg_rgb]
|
177
|
-
contok = df[:bg_rgb] ? (df[:min_cont]..df[:max_cont]).cover?( color.contrast(df[:bg_rgb]) ) : true
|
178
|
-
#puts "contok "+contok.to_s
|
179
|
-
brightok = (df[:min_bright]..df[:max_bright]).cover?( color.to_hsl.brightness )
|
180
|
-
#puts "brightok "+brightok.to_s
|
181
|
-
end
|
182
|
-
|
183
|
-
cn = color.html
|
184
|
-
cn= cn.slice(1,cn.size)
|
185
|
-
return cn
|
186
|
-
end
|
187
|
-
|
188
|
-
def set_doc_colors
|
189
|
-
newopt = []
|
190
|
-
@@doc_color_keys.each do |o|
|
191
|
-
if o == "CARET_ROW_COLOR" then
|
192
|
-
@caret_row_color = randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.05,:max_cont => 0.08,:shade_of_grey=>false)
|
193
|
-
newopt << {:name=> o, :value => @caret_row_color }
|
194
|
-
elsif o.include?("SELECTION_BACKGROUND") then
|
195
|
-
@selection_background = randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.07,:max_cont => 0.09,:shade_of_grey=>false)
|
196
|
-
newopt << {:name=> o, :value => @selection_background }
|
197
|
-
elsif o.include?("SELECTION_FOREGROUND") then
|
198
|
-
newopt << {:name=> o }
|
199
|
-
elsif o.include?("GUTTER_BACKGROUND") then
|
200
|
-
newopt << {:name=> o, :value => @backgroundcolor }
|
201
|
-
elsif o.include?("CARET_COLOR") then
|
202
|
-
newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.30,:max_cont=>0.7,:shade_of_grey=>true) }
|
203
|
-
|
204
|
-
elsif o.include?("READONLY_BACKGROUND") then
|
205
|
-
newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.03,:max_cont=>0.09,:shade_of_grey=>@background_grey) }
|
206
|
-
elsif o.include?("READONLY_FRAGMENT_BACKGROUND") then
|
207
|
-
newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.03,:max_cont=>0.09,:shade_of_grey=>@background_grey) }
|
208
|
-
|
209
|
-
else
|
210
|
-
# puts "bgc"+@backgroundcolor
|
211
|
-
newopt << {:name=> o, :value => randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>@min_cont,:max_cont=>@max_cont,:shade_of_grey=>@background_grey).to_s }
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
@xmlout[:scheme][0][:colors][0][:option] = newopt
|
216
|
-
#Kernel.exit
|
217
|
-
end
|
218
|
-
|
219
|
-
def set_doc_options
|
220
|
-
newopt = []
|
221
|
-
newopt << {:name => "LINE_SPACING",:value=>'1.0' } #:value=>'1.3' works all right
|
222
|
-
newopt << {:name => "EDITOR_FONT_SIZE",:value => "16"} #:value = "14" is a safe default if you want to specify something
|
223
|
-
newopt << {:name => "EDITOR_FONT_NAME",:value => "DejaVu Sans Mono" }
|
224
|
-
@xmlout[:scheme][0][:option] = newopt
|
225
|
-
end
|
226
|
-
|
227
|
-
def set_element_colors
|
228
|
-
newopt = []
|
229
|
-
newopt[0]={:option=>[]}
|
230
|
-
################ set the fonttype
|
231
|
-
@@element_keys.each do |o|
|
232
|
-
fonttype = 0 #bold: 1, #italic: 2, bold & italic: 3
|
233
|
-
@bold_candidates.each do |bc|
|
234
|
-
if o.include? bc.to_s then
|
235
|
-
if @rand.rand < @bold_chance then fonttype = 1 end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
@italic_candidates.each do |ic|
|
239
|
-
if o.include? ic.to_s then
|
240
|
-
if @rand.rand < @italic_chance then fonttype += 2 end
|
241
|
-
end
|
242
|
-
end
|
243
|
-
#this block is for setting up special cases for the new color - ie, comments darker,
|
244
|
-
#reserved words are yellowins, whatever
|
245
|
-
fonttype = "" unless fonttype.is_a? Fixnum
|
246
|
-
case
|
247
|
-
when o.include?( "COMMENT")
|
248
|
-
#comments -- this is done so that COMMENTED texts skew toward darker shades.
|
249
|
-
newcol = randcolor(:bg_rgb=>@backgroundcolor, :min_cont=>0.25, :max_cont => 0.27)
|
250
|
-
optblj=[{:option=>[ {:name => "FOREGROUND", :value => newcol},
|
251
|
-
# {:name => "BACKGROUND", :value =>@backgroundcolor},
|
252
|
-
{:name => "BACKGROUND"},
|
253
|
-
{:name => "EFFECT_COLOR" },{:name => "FONT_TYPE", :value=>fonttype.to_s },
|
254
|
-
{:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor) }]}]
|
255
|
-
#default text and background for whole document
|
256
|
-
when ["TEXT","FOLDED_TEXT_ATTRIBUTES"].include?( o.to_s)
|
257
|
-
newcol = randcolor(:bg_rgb=>@backgroundcolor )
|
258
|
-
optblj=[{:option=>[ {:name => "FOREGROUND", :value => newcol},
|
259
|
-
{:name => "BACKGROUND", :value =>@backgroundcolor},
|
260
|
-
{:name => "EFFECT_COLOR" },{:name => "FONT_TYPE", :value=>fonttype.to_s },
|
261
|
-
{:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor)}]}]
|
262
|
-
when @code_inspections.include?(o.to_s)
|
263
|
-
newcol = randcolor(:bg_rgb=>@backgroundcolor)
|
264
|
-
optblj=[{:option=>[ {:name => "FOREGROUND"},
|
265
|
-
{:name => "BACKGROUND"},
|
266
|
-
{:name => "EFFECT_COLOR", :value =>newcol},{:name => "FONT_TYPE", :value=>fonttype.to_s },
|
267
|
-
{:name => "EFFECT_TYPE", :value=>@unders.shuffle[0].to_s },
|
268
|
-
{:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor) }]}]
|
269
|
-
when @cross_out.include?(o.to_s)
|
270
|
-
newcol = randcolor(:bg_rgb=>@backgroundcolor)
|
271
|
-
optblj=[{:option=>[ {:name => "FOREGROUND"},
|
272
|
-
{:name => "BACKGROUND"},
|
273
|
-
{:name => "EFFECT_COLOR", :value =>newcol},{:name => "FONT_TYPE", :value=>fonttype.to_s },
|
274
|
-
{:name => "EFFECT_TYPE", :value=>"3" },
|
275
|
-
{:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor)}]}]
|
276
|
-
else
|
277
|
-
newcol=randcolor(:bg_rgb=>@backgroundcolor)
|
278
|
-
optblj=[{:option=>[ {:name => "FOREGROUND", :value => newcol},
|
279
|
-
{:name => "BACKGROUND"},
|
280
|
-
{:name => "EFFECT_COLOR" },{:name => "FONT_TYPE", :value=>fonttype.to_s },
|
281
|
-
{:name => "ERROR_STRIPE_COLOR", :value =>randcolor(:bg_rgb=>@backgroundcolor) }]}]
|
282
|
-
end
|
283
|
-
newopt[0][:option] << {:name =>o.to_s , :value=>optblj}
|
284
|
-
end
|
285
|
-
@xmlout[:scheme][0][:attributes] = newopt
|
286
|
-
end
|
287
|
-
|
288
|
-
def make_geany_files
|
289
|
-
rantm = randthemename
|
290
|
-
geanydir ="geany_"+rantm
|
291
|
-
Dir.mkdir(geanydir)
|
292
|
-
f=File.new(geanydir+"/filetypes.xml","w+")
|
293
|
-
f.puts('[styling]')
|
294
|
-
#these are for php, html, sgml, xml
|
295
|
-
@@geany_tokens.each do |t|
|
296
|
-
# foreground;background;bold;italic
|
297
|
-
if t.upcase.include? "COMMENT" then
|
298
|
-
f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.12, :max_cont=>0.22)+";0x"+@backgroundcolor+";"+"false;false")
|
299
|
-
else
|
300
|
-
f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor)+";0x"+@backgroundcolor+";false"+";false")
|
301
|
-
end
|
302
|
-
end
|
303
|
-
f.puts(@@geany_filetypes_post)
|
304
|
-
f.close
|
305
|
-
|
306
|
-
geanydir ="geany_"+rantm
|
307
|
-
f=File.new(geanydir+"/filetypes.ruby","w+")
|
308
|
-
f.puts('[styling]')
|
309
|
-
@@geany_ruby_tokens.each do |t|
|
310
|
-
# foreground;background;bold;italic
|
311
|
-
if t.upcase.include? "COMMENT" then
|
312
|
-
f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.12, :max_cont=>0.22)+";0x"+@backgroundcolor+";"+"false;false")
|
313
|
-
else
|
314
|
-
f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor)+";0x"+@backgroundcolor+";false"+";false")
|
315
|
-
end
|
316
|
-
end
|
317
|
-
f.puts(@@geany_filetypes_post)
|
318
|
-
f.close
|
319
|
-
end
|
320
|
-
|
321
|
-
def make_theme_files
|
322
|
-
# @default_fg = @backgroundcolor
|
323
|
-
# puts "backgroundcolor = "+@backgroundcolor
|
324
|
-
@iterations.times do
|
325
|
-
@backgroundcolor= randcolor(:shade_of_grey=>@background_grey, :max_bright=>@background_max_brightness)# "0"
|
326
|
-
@schemename = randthemename
|
327
|
-
@xmlout = {:scheme=>
|
328
|
-
[{:name => @schemename,:version=>@schemeversion,:parent_scheme=>"Default",
|
329
|
-
:option =>[{:name=>"pencil length",:value=>"48 cm"},{:name => "Doowop level", :value=>"medium"}],
|
330
|
-
:colors => [{ :option => [{:name=>"foreground",:value => "yellow"},{:name=>"background",:value => "black"} ] }],
|
331
|
-
:attributes => [{:option=>[
|
332
|
-
{:name=>"2ABSTRACT_CLASS_NAME_ATTRIBUTES", :value=>[{:option=>{:name=>"foreground",:value=>"red"}}] },
|
333
|
-
{:name=>"4ABSTRACT_CLASS_NAME_ATTRIBUTES", :value=>[{:option=>{:name=>"foreground",:value=>"red"}}] }
|
334
|
-
]
|
335
|
-
}]
|
336
|
-
}]
|
337
|
-
}
|
338
|
-
@savefile = randfilename(@schemename)
|
339
|
-
@outf = File.new(@savefile, "w+")
|
340
|
-
|
341
|
-
set_doc_options
|
342
|
-
set_doc_colors
|
343
|
-
set_element_colors
|
344
|
-
# @outf.puts @@mybanner
|
345
|
-
XmlSimple.xml_out(@xmlout,{:keeproot=>true,:xmldeclaration=>true,:outputfile=> @outf, :rootname => "scheme"})
|
346
|
-
puts "outputting to file "+@savefile
|
347
|
-
@outf.close
|
348
|
-
puts "making geany directory "+make_geany_files.to_s
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
|
353
|
-
end #class
|
354
|
-
end #module
|
355
|
-
|
356
|
-
l = RMThemeGen::ThemeGenerator.new
|
357
|
-
l.make_theme_files
|