rmthemegen 0.0.16 → 0.0.17
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/rmthemegen_187.rb +31 -10
- data/lib/rmthemegen/version.rb +1 -1
- data/rmthemegen.gemspec +1 -1
- data/test/test_generate_themes.rb +4 -2
- metadata +3 -4
- data/test/rmt_uncomfortable_staircase.xml +0 -2088
@@ -60,9 +60,9 @@ module RMThemeGen
|
|
60
60
|
@italic_chance = 0.2
|
61
61
|
@bold_chance = 0.4
|
62
62
|
@underline_chance = 0.3
|
63
|
-
@bright_median = 0.85
|
64
|
-
@min_bright = @bright_median * 0.65
|
65
|
-
@max_bright = [@bright_median * 1.35,1.0].max
|
63
|
+
# @bright_median = 0.85
|
64
|
+
# @min_bright = @bright_median * 0.65
|
65
|
+
# @max_bright = [@bright_median * 1.35,1.0].max
|
66
66
|
|
67
67
|
@min_bright = 0.0
|
68
68
|
@max_bright = 1.0
|
@@ -81,7 +81,9 @@ module RMThemeGen
|
|
81
81
|
|
82
82
|
@schemeversion = 1
|
83
83
|
@background_max_brightness = 0.14
|
84
|
+
@background_min_brightness = 0.65
|
84
85
|
@background_grey = true #if false, allows background to be any color, as long as it meets brightness parameter
|
86
|
+
@bg_color_style = 0 #0 = grey/dark 1 = grey/light (whitish), 2 = any color
|
85
87
|
# @foreground_min_brightness = 0.4
|
86
88
|
|
87
89
|
|
@@ -135,10 +137,10 @@ module RMThemeGen
|
|
135
137
|
#puts "contrast "+color.contrast(df[:bg_rgb]).to_s if df[:bg_rgb]
|
136
138
|
contok = df[:bg_rgb] ? (df[:min_cont]..df[:max_cont]).include?( color.contrast(df[:bg_rgb]) ) : true
|
137
139
|
#puts "contok "+contok.to_s
|
138
|
-
brightok =
|
140
|
+
brightok = (df[:min_bright]..df[:max_bright]).include?( color.to_hsl.brightness )
|
141
|
+
|
139
142
|
#puts "brightok "+brightok.to_s
|
140
143
|
end
|
141
|
-
|
142
144
|
cn = color.html
|
143
145
|
cn= cn.slice(1,cn.size)
|
144
146
|
return cn
|
@@ -277,10 +279,29 @@ module RMThemeGen
|
|
277
279
|
f.close
|
278
280
|
end
|
279
281
|
|
280
|
-
def make_theme_file(
|
281
|
-
|
282
|
-
|
283
|
-
|
282
|
+
def make_theme_file(opts = {})
|
283
|
+
defaults = Hash.new
|
284
|
+
defaults[:outputdir] = ENV["PWD"]
|
285
|
+
defaults[:bg_color_style] = 0
|
286
|
+
opts = defaults.merge opts
|
287
|
+
@bg_color_style = opts[:bg_color_style]
|
288
|
+
@background_grey = (opts[:bg_color_style] < 2) #whitish or blackish bg are both "grey"
|
289
|
+
|
290
|
+
case opts[:bg_color_style]
|
291
|
+
when 0 #blackish background
|
292
|
+
@background_min_brightness = 0.0
|
293
|
+
@background_max_brightness = 0.14
|
294
|
+
when 1 #whitish background
|
295
|
+
@background_min_brightness = 0.75
|
296
|
+
@background_max_brightness = 1.0
|
297
|
+
when 2 #colored (any) bg
|
298
|
+
@background_min_brightness = 0.0
|
299
|
+
@background_max_brightness = 1.0
|
300
|
+
end
|
301
|
+
@backgroundcolor= randcolor(:shade_of_grey=>@background_grey, :max_bright=>@background_max_brightness,
|
302
|
+
:min_bright => @background_min_brightness )# "0"
|
303
|
+
@schemename = randthemename
|
304
|
+
@xmlout = {:scheme=>
|
284
305
|
[{:name => @schemename,:version=>@schemeversion,:parent_scheme=>"Default",
|
285
306
|
:option =>[{:name=>"pencil length",:value=>"48 cm"},{:name => "Doowop level", :value=>"medium"}],
|
286
307
|
:colors => [{ :option => [{:name=>"foreground",:value => "yellow"},{:name=>"background",:value => "black"} ] }],
|
@@ -292,7 +313,7 @@ module RMThemeGen
|
|
292
313
|
}]
|
293
314
|
}
|
294
315
|
@savefile = randfilename(@schemename)
|
295
|
-
@outf = File.new(outputdir+"/"+@savefile, "w+")
|
316
|
+
@outf = File.new(opts[:outputdir]+"/"+@savefile, "w+")
|
296
317
|
set_doc_options
|
297
318
|
set_doc_colors
|
298
319
|
set_element_colors
|
data/lib/rmthemegen/version.rb
CHANGED
data/rmthemegen.gemspec
CHANGED
@@ -21,8 +21,10 @@ puts
|
|
21
21
|
l = RMThemeGen::ThemeGenerator.new
|
22
22
|
|
23
23
|
|
24
|
-
|
25
|
-
puts l.make_theme_file
|
24
|
+
10.times do
|
25
|
+
# puts l.make_theme_file(:outputdir => ENV["PWD"],:bg_color_style => 0 )
|
26
|
+
puts l.make_theme_file(:outputdir => ENV["PWD"],:bg_color_style => 1 )
|
27
|
+
# puts l.make_theme_file(:outputdir => ENV["PWD"],:bg_color_style => 2 )
|
26
28
|
end
|
27
29
|
puts "testing to_css"
|
28
30
|
puts l.to_css
|
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: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 17
|
10
|
+
version: 0.0.17
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Heitzman
|
@@ -89,7 +89,6 @@ files:
|
|
89
89
|
- lib/rmthemegen/version.rb
|
90
90
|
- rmthemegen.gemspec
|
91
91
|
- test/index.html
|
92
|
-
- test/rmt_uncomfortable_staircase.xml
|
93
92
|
- test/rmthemegen_spec.rb
|
94
93
|
- test/sample_ruby_source
|
95
94
|
- test/test_generate_themes.rb
|