rmthemegen 0.0.28 → 0.0.29

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.
@@ -37,7 +37,7 @@ l = RMThemeGen::ThemeGenerator.new
37
37
  @iterations = @iterations.to_i
38
38
 
39
39
  @iterations.times do
40
- puts l.make_theme_file
40
+ puts l.make_theme_file()
41
41
  end
42
42
 
43
43
 
@@ -27,6 +27,9 @@ module RMThemeGen
27
27
  attr_reader :xmlout #a huge structure of xml that can be given to XmlSimple.xml_out() to create that actual color theme file
28
28
 
29
29
  def initialize
30
+ @random_seed = Kernel.srand
31
+ Kernel.srand(@random_seed)
32
+
30
33
  @theme_successfully_created = false
31
34
 
32
35
  @iterations = 1
@@ -61,20 +64,17 @@ module RMThemeGen
61
64
  @italic_chance = 0.2
62
65
  @bold_chance = 0.4
63
66
  @underline_chance = 0.3
64
- # @bright_median = 0.85
65
- # @min_bright = @bright_median * 0.65
66
- # @max_bright = [@bright_median * 1.35,1.0].max
67
67
 
68
- @min_bright = 0.0
69
- @max_bright = 1.0
68
+ @min_bright = 0.0
69
+ @max_bright = 1.0
70
70
 
71
71
  # if we avoid any notion of "brightness", which is an absolute quality, then we
72
- # can make our background any color we want !
72
+ # can make our background any color we want, then adjust contrast to taste
73
73
 
74
74
  #tighter contrast spec
75
75
  @cont_median = 0.85
76
- @min_cont = @cont_median * 0.65
77
- @max_cont = [@cont_median * 1.35,1.0].max
76
+ @min_cont = @cont_median * 0.65
77
+ @max_cont = [@cont_median * 1.35,1.0].max
78
78
 
79
79
  #broad contrast spec
80
80
  @min_cont = 0.30
@@ -248,8 +248,9 @@ module RMThemeGen
248
248
  def set_doc_options
249
249
  newopt = []
250
250
  newopt << {:name => "LINE_SPACING",:value=>'1.0' } #:value=>'1.3' works all right
251
- newopt << {:name => "EDITOR_FONT_SIZE",:value => "16"} #:value = "14" is a safe default if you want to specify something
251
+ newopt << {:name => "EDITOR_FONT_SIZE",:value => "12"} #:value = "14" is a safe default if you want to specify something
252
252
  newopt << {:name => "EDITOR_FONT_NAME",:value => "DejaVu Sans Mono" }
253
+ newopt << {:name => "RANDOM_SEED",:value => @random_seed.to_s }
253
254
  @xmlout[:scheme][0][:option] = newopt
254
255
  end
255
256
 
@@ -313,43 +314,12 @@ module RMThemeGen
313
314
  end
314
315
  @xmlout[:scheme][0][:attributes] = newopt
315
316
  end
316
-
317
- def make_geany_files
318
- rantm = randthemename
319
- geanydir ="geany_"+rantm
320
- Dir.mkdir(geanydir)
321
- f=File.new(geanydir+"/filetypes.xml","w+")
322
- f.puts('[styling]')
323
- #these are for php, html, sgml, xml
324
- @@geany_tokens.each do |t|
325
- # foreground;background;bold;italic
326
- if t.upcase.include? "COMMENT" then
327
- f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.12, :max_cont=>0.22)+";0x"+@backgroundcolor+";"+"false;false")
328
- else
329
- f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor)+";0x"+@backgroundcolor+";false"+";false")
330
- end
331
- end
332
- f.puts(@@geany_filetypes_post)
333
- f.close
334
-
335
- geanydir ="geany_"+rantm
336
- f=File.new(geanydir+"/filetypes.ruby","w+")
337
- f.puts('[styling]')
338
- @@geany_ruby_tokens.each do |t|
339
- # foreground;background;bold;italic
340
- if t.upcase.include? "COMMENT" then
341
- f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor,:min_cont=>0.12, :max_cont=>0.22)+";0x"+@backgroundcolor+";"+"false;false")
342
- else
343
- f.puts(t+"=0x"+randcolor(:bg_rgb=>@backgroundcolor)+";0x"+@backgroundcolor+";false"+";false")
344
- end
345
- end
346
- f.puts(@@geany_filetypes_post)
347
- f.close
348
- end
349
317
 
350
318
  # (output directory, bg_color_style, colorsets [])
351
- def make_theme_file(outputdir = ENV["PWD"], bg_color_style=0, colorsets=[])
319
+ def make_theme_file(outputdir = ENV["PWD"], bg_color_style=0, colorsets=[], rand_seed=nil)
352
320
  #bg_color_style: 0 = blackish, 1 = whitish, 2 = any color
321
+ @random_seed = rand_seed || Kernel.srand
322
+ Kernel.srand(@random_seed)
353
323
  @theme_successfully_created=false
354
324
  defaults = {}
355
325
  defaults[:outputdir] = outputdir
@@ -382,21 +352,23 @@ module RMThemeGen
382
352
  :min_bright => @background_min_brightness )# "0"
383
353
  @themename = randthemename
384
354
  @xmlout = {:scheme=>
385
- [{:name => @themename,:version=>@themeversion,:parent_scheme=>"Default",
386
- :option =>[{:name=>"pencil length",:value=>"48 cm"},{:name => "Doowop level", :value=>"medium"}],
387
- :colors => [{ :option => [{:name=>"foreground",:value => "yellow"},{:name=>"background",:value => "black"} ] }],
355
+ [{
388
356
  :attributes => [{:option=>[
389
357
  {:name=>"2ABSTRACT_CLASS_NAME_ATTRIBUTES", :value=>[{:option=>{:name=>"foreground",:value=>"red"}}] },
390
358
  {:name=>"4ABSTRACT_CLASS_NAME_ATTRIBUTES", :value=>[{:option=>{:name=>"foreground",:value=>"red"}}] }
391
359
  ]
392
- }]
360
+ }],
361
+ :colors => [{ :option => [{:name=>"foreground",:value => "yellow"},{:name=>"background",:value => "black"} ],
362
+ :option =>[{:name=>"pencil length",:value=>"48 cm"},{:name => "Doowop level", :value=>"medium"}]
363
+ }],
364
+ :name => @themename,:version=>@themeversion,:parent_scheme=>"Default", :author=>"David Heitzman, http://rmthemegen.com"
393
365
  }]
394
366
  }
395
367
  @savefile = randfilename(@themename)
396
368
  @outf = File.new(opts[:outputdir]+"/"+@savefile, "w+")
397
- set_doc_options
398
- set_doc_colors
399
369
  set_element_colors
370
+ set_doc_colors
371
+ set_doc_options
400
372
  XmlSimple.xml_out(@xmlout,{:keeproot=>true,:xmldeclaration=>true,:outputfile=> @outf, :rootname => "scheme"})
401
373
  @outf.close
402
374
  @theme_successfully_created = true
@@ -1,3 +1,3 @@
1
1
  module Rmthemegen
2
- VERSION = "0.0.28"
2
+ VERSION = "0.0.29"
3
3
  end
data/rmthemegen.gemspec CHANGED
@@ -4,7 +4,7 @@ require "rmthemegen/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "rmthemegen"
7
- s.version = "0.0.28"
7
+ s.version = "0.0.29"
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["David Heitzman"]
10
10
  s.email = ["evolvemeans@gmail.com"]
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: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 28
10
- version: 0.0.28
9
+ - 29
10
+ version: 0.0.29
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heitzman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-05 00:00:00 -05:00
18
+ date: 2011-07-10 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency