autocolors 0.0.1 → 0.0.2
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/{format-samples → .attic/format-samples}/1/Sweyla866607.css +0 -0
- data/{format-samples → .attic/format-samples}/1/Sweyla866607.tmTheme +0 -0
- data/{format-samples → .attic/format-samples}/1/Sweyla866607.txt +0 -0
- data/{format-samples → .attic/format-samples}/1/sweyla866607.el +0 -0
- data/{format-samples → .attic/format-samples}/1/sweyla866607.vim +0 -0
- data/.helper-vimrc +34 -0
- data/.samples/vim/colors/aphakia.vim +487 -0
- data/.samples/vim/colors/ascian.vim +487 -0
- data/.samples/vim/colors/bolognese.vim +487 -0
- data/.samples/vim/colors/breeze.vim +487 -0
- data/.samples/vim/colors/celemin.vim +487 -0
- data/.samples/vim/colors/coquilla.vim +487 -0
- data/.samples/vim/colors/filasse.vim +487 -0
- data/.samples/vim/colors/gradable.vim +487 -0
- data/.samples/vim/colors/harbinger.vim +487 -0
- data/.samples/vim/colors/kashima.vim +487 -0
- data/{sample-output/chalazal.vim → .samples/vim/colors/knockdown.vim} +379 -369
- data/.samples/vim/colors/manful.vim +487 -0
- data/.samples/vim/colors/maximal.vim +487 -0
- data/{sample-output/canister.vim → .samples/vim/colors/periclase.vim} +375 -365
- data/.samples/vim/colors/poesis.vim +487 -0
- data/.samples/vim/colors/proton.vim +487 -0
- data/{sample-output/hello_hello.vim → .samples/vim/colors/recedence.vim} +370 -360
- data/.samples/vim/colors/scram.vim +487 -0
- data/.samples/vim/colors/server.vim +487 -0
- data/{sample-output/singsong.vim → .samples/vim/colors/shrubbish.vim} +379 -369
- data/{sample-output/upbind.vim → .samples/vim/colors/sultam.vim} +355 -345
- data/.samples/vim/colors/virtuoso.vim +487 -0
- data/.samples/vim/colors/wherrit.vim +487 -0
- data/{sample-output/unflorid.vim → .samples/vim/colors/winsome.vim} +366 -356
- data/.samples/vim/colors/wirelike.vim +487 -0
- data/.samples/vim/syntax/actionscript.vim +173 -0
- data/.samples/vim/syntax/erlang.vim +151 -0
- data/.samples/vim/syntax/haxe.vim +427 -0
- data/Rakefile +195 -0
- data/TODO.md +17 -0
- data/VERSION +1 -1
- data/autocolors.gemspec +44 -20
- data/bin/autocolors +4 -0
- data/lib/VERSION +1 -1
- data/lib/autocolors/colorscheme.rb +19 -16
- data/lib/autocolors/mapping.udon +17 -16
- data/quicktest.html +70745 -0
- metadata +135 -159
data/Rakefile
CHANGED
@@ -57,3 +57,198 @@ task :default => :test
|
|
57
57
|
|
58
58
|
require 'yard'
|
59
59
|
YARD::Rake::YardocTask.new
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
langs = {#'ActionScript' =>['as'],
|
64
|
+
'C' =>['c','h'],
|
65
|
+
'C#' =>['cs'],
|
66
|
+
'C++' =>['cpp','hpp'],
|
67
|
+
'Common Lisp' =>['lisp'],
|
68
|
+
###'CSS' =>['css'],
|
69
|
+
'Emacs Lisp' =>['el'],
|
70
|
+
'Erlang' =>['erl','hrl'],
|
71
|
+
'Haxe' =>['hx'],
|
72
|
+
'Haskell' =>['hs'],
|
73
|
+
###'HTML' =>['html'],
|
74
|
+
'Java' =>['java'],
|
75
|
+
'JavaScript' =>['js'],
|
76
|
+
'Lua' =>['lua'],
|
77
|
+
'Objective-C' =>['m','h'],
|
78
|
+
'Perl' =>['pl'],
|
79
|
+
'PHP' =>['php'],
|
80
|
+
'Python' =>['py'],
|
81
|
+
'Ruby' =>['rb'],
|
82
|
+
'Scala' =>['scala'],
|
83
|
+
'Scheme' =>['scm','ss'],
|
84
|
+
'Shell' =>['sh']
|
85
|
+
###'XML' =>['xml']
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
def friendlyname(str)
|
90
|
+
str.downcase.gsub('#','-sharp').gsub(/\s+/,'_').gsub(/[^a-zA-Z0-9+_-]/,'')
|
91
|
+
end
|
92
|
+
|
93
|
+
namespace :samples do
|
94
|
+
require 'pp'
|
95
|
+
desc 'Generate html syntax highlighting samples for pieces of popular opensource'
|
96
|
+
task :generate => [:update_repositories, :generate_colorschemes, :generate_html]
|
97
|
+
|
98
|
+
$sample_files = {}
|
99
|
+
task :update_repositories do
|
100
|
+
require 'json'
|
101
|
+
require 'uri'
|
102
|
+
currentd = Dir.pwd
|
103
|
+
mkdir_p './.samples/repos'
|
104
|
+
Dir.chdir './.samples/repos'
|
105
|
+
langs.each do |lang, extensions|
|
106
|
+
puts "\n\n=== Checking popular repositories for: #{lang} ==="
|
107
|
+
popular = `curl --retry 4 'https://github.com/languages/#{URI.escape(lang)}'`[/Most Forked This Month.*?<\/div>/mui]
|
108
|
+
repos = popular.scan /href="\/([^\/"]+)\/([^"\/]+)"/
|
109
|
+
search_paths = []
|
110
|
+
repos.each do |user, repo|
|
111
|
+
puts "--- #{user} / #{repo} ---"
|
112
|
+
unless File.exists? "#{user}/#{repo}"
|
113
|
+
puts ''
|
114
|
+
info = JSON.parse `curl --retry 2 'https://api.github.com/repos/#{user}/#{repo}'`
|
115
|
+
unless info['clone_url'].nil?
|
116
|
+
mkdir_p "#{user}"
|
117
|
+
`git clone --depth 1 '#{info['clone_url']}' '#{user}/#{repo}'`
|
118
|
+
end
|
119
|
+
end
|
120
|
+
search_paths << "'./#{user}/#{repo}'"
|
121
|
+
end
|
122
|
+
extensions.each do |ext|
|
123
|
+
cmd = "find -x -f #{search_paths.join(' ')} -iregex '.*\\.#{ext}' -type f -size 4"
|
124
|
+
candidate_files = `#{cmd}`.split("\n").map{|fn|fn.strip}
|
125
|
+
randf = candidate_files[rand(candidate_files.size)]
|
126
|
+
unless randf.nil? or randf == ''
|
127
|
+
git_path = randf.split '/'
|
128
|
+
git_path.shift if git_path[0] == '.'
|
129
|
+
user = git_path.shift
|
130
|
+
repo = git_path.shift
|
131
|
+
lang = lang + ' (2)' if $sample_files.has_key? lang
|
132
|
+
$sample_files[lang] = ["https://github.com/#{user}/#{repo}/tree/master/#{git_path.join('/')}", File.expand_path(randf)]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
pp $sample_files
|
137
|
+
Dir.chdir currentd
|
138
|
+
end
|
139
|
+
|
140
|
+
$sample_colorschemes = []
|
141
|
+
task :generate_colorschemes do
|
142
|
+
currentd = Dir.pwd
|
143
|
+
mkdir_p './.samples/vim/colors'
|
144
|
+
Dir.chdir './.samples/vim/colors'
|
145
|
+
`rm * 2>/dev/null`
|
146
|
+
(1..25).each{ `/bin/bash -c '../../../bin/autocolors'` }
|
147
|
+
$sample_colorschemes = `ls *.vim`.strip.split(/\s+/).map{|c| c.strip[0..-5]}
|
148
|
+
pp $sample_colorschemes
|
149
|
+
Dir.chdir currentd
|
150
|
+
end
|
151
|
+
|
152
|
+
task :generate_html do
|
153
|
+
vimrc = '../../.helper-vimrc'
|
154
|
+
currentd = Dir.pwd
|
155
|
+
mkdir_p './.samples/html'
|
156
|
+
Dir.chdir './.samples/html'
|
157
|
+
`rm *.html *.pre`
|
158
|
+
prefiles = []
|
159
|
+
$sample_files.each do |lang, locs|
|
160
|
+
gh_loc, f_loc = locs
|
161
|
+
$sample_colorschemes.each do |cs|
|
162
|
+
['dark','light'].each do |bg|
|
163
|
+
dest_fname = "./#{cs}-#{friendlyname(lang)}-#{bg}.html"
|
164
|
+
precmds = ["set runtimepath+=../../.samples/vim/",
|
165
|
+
"set background=#{bg}",
|
166
|
+
"colorscheme #{cs}"]
|
167
|
+
postcmds = ["TOhtml",
|
168
|
+
"w #{dest_fname}.pre",
|
169
|
+
"qa!"]
|
170
|
+
precmds = precmds.map{|c| "--cmd '#{c}'"}.join(' ')
|
171
|
+
postcmds = postcmds.map{|c| "-c '#{c}'"}.join(' ')
|
172
|
+
cmd = "gvim -i NONE -f -n -g -b -N --noplugin #{precmds} -u '#{vimrc}' '#{f_loc}' #{postcmds}"
|
173
|
+
`#{cmd}`
|
174
|
+
prefiles << ["#{dest_fname}.pre", gh_loc, bg, cs]
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
prefiles.each do |destf, gh_loc, bg, cs|
|
180
|
+
txt = IO.read(destf)
|
181
|
+
bg_base = '#333'
|
182
|
+
fg_base = '#777'
|
183
|
+
if txt =~ /<body\s*bgcolor="([^"]+)"\s*text="([^"]+)"/
|
184
|
+
bg_base = $1
|
185
|
+
fg_base = $2
|
186
|
+
end
|
187
|
+
|
188
|
+
txt = txt[/<font face.*?<\/font>\s*<\/body>/mui]
|
189
|
+
header = <<-HTML
|
190
|
+
<div class="sample #{bg}" style="background-color: #{bg_base}; color: #{fg_base};">
|
191
|
+
<div class="colorscheme-name">#{cs}/#{bg}</div>
|
192
|
+
<div class="filename">#{gh_loc}</div>
|
193
|
+
<div class="vim">
|
194
|
+
HTML
|
195
|
+
txt = txt.gsub(/\A<[^<]+/mui,header).gsub(/<\/font>\s*<\/body>.*/mui, '</div></div>')
|
196
|
+
File.open(destf[0..-5],'w+'){|f| f.write(txt)}
|
197
|
+
sh "rm #{destf}"
|
198
|
+
end
|
199
|
+
Dir.chdir currentd
|
200
|
+
end
|
201
|
+
|
202
|
+
desc 'Aggregate html samples in .samples/html and style them > quicktest.html'
|
203
|
+
task :combine_html do
|
204
|
+
start = <<-HTML
|
205
|
+
<html>
|
206
|
+
<head><title>Sample colorschemes</title>
|
207
|
+
<style type="text/css">
|
208
|
+
body {
|
209
|
+
background-color: #444;
|
210
|
+
}
|
211
|
+
span {
|
212
|
+
padding-left: 3px;
|
213
|
+
}
|
214
|
+
div.sample {
|
215
|
+
width: 390px;
|
216
|
+
height: 500px;
|
217
|
+
overflow: hidden;
|
218
|
+
border: 4px solid black;
|
219
|
+
margin: 5px;
|
220
|
+
float: left;
|
221
|
+
font-family: Consolas, Inconsolas, Monaco, monotype;
|
222
|
+
font-size: 8pt;
|
223
|
+
white-space: nowrap;
|
224
|
+
}
|
225
|
+
div.colorscheme-name {
|
226
|
+
font-family: sans-serif;
|
227
|
+
background-color: black;
|
228
|
+
color: #cdd;
|
229
|
+
text-decoration: underline;
|
230
|
+
font-size: 12pt;
|
231
|
+
}
|
232
|
+
div.filename {
|
233
|
+
font-family: sans-serif;
|
234
|
+
background-color: black;
|
235
|
+
color: #cdd;
|
236
|
+
font-size: 7pt;
|
237
|
+
padding-bottom: 4px;
|
238
|
+
border-bottom: 4px solid white;
|
239
|
+
}
|
240
|
+
div.vim {
|
241
|
+
height: 450px;
|
242
|
+
overflow: scroll;
|
243
|
+
}
|
244
|
+
|
245
|
+
</style>
|
246
|
+
</head>
|
247
|
+
<body>
|
248
|
+
HTML
|
249
|
+
|
250
|
+
File.open('quicktest.html','w+'){|f| f.write(start) }
|
251
|
+
sh 'ls .samples/html/*.html | grep -v actionscript | grep -v haxe | xargs cat >> quicktest.html'
|
252
|
+
File.open('quicktest.html','a'){|f| f.write("\n</body></html>")}
|
253
|
+
end
|
254
|
+
end
|
data/TODO.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
- [ ] A real good sample syntax/document with "common" densities for displaying full colorsheme - both standard and extended.
|
2
|
+
- [ ] Autogenerate some vim examples in order to test colorschemes generally for iterating
|
3
|
+
- [ ] Fix highlight color so it's more coherent
|
4
|
+
- [ ] Fix TODO / etc. so they're more coherent
|
5
|
+
- [~] Change mapping a bit so that one tick is very small variation, and more ticks increase but linearly, and use more ticks in most places.
|
6
|
+
- [ ] Fix vim "~"-line background color so it's only very slightly different from normal background.
|
7
|
+
- [ ] Heroku site for showing it off / generating them online
|
8
|
+
- [ ] Indicate frequency and average sizes in mapping - for use in constraints
|
9
|
+
- [ ] Constraints - make sure certain groups/mappings end up with colors that are far enough apart, or not too far apart, etc. etc. After first pass colors, modify according to constraints until it's stable.
|
10
|
+
- [ ] Fix translation to 256-colorspace
|
11
|
+
- [ ] Fix translation to 16-colorspace
|
12
|
+
- [ ] Fix overall mapping structure heirarchy
|
13
|
+
- [ ] Finish out all vim (esp. ui at this point) groups
|
14
|
+
- [ ] Fix commandline interface so it is standard and good
|
15
|
+
- [ ] Integrate with http://bashish.sourceforge.net/ ?
|
16
|
+
- [ ] Blog entry
|
17
|
+
- [ ] Announce
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/autocolors.gemspec
CHANGED
@@ -4,15 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.0.
|
7
|
+
s.name = "autocolors"
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joseph Wecker"]
|
12
|
-
s.date =
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
s.email = %q{joseph.wecker@gmail.com}
|
12
|
+
s.date = "2011-09-20"
|
13
|
+
s.description = "Inspired by solarized, and lots of work with various colorschemes and syntax highlight files, and driven by a need to have some color variety that doesn't stink. Tries to generate colorschemes with just the right contrast, variety, and coherence."
|
14
|
+
s.email = "joseph.wecker@gmail.com"
|
16
15
|
s.executables = ["autocolors"]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE.txt",
|
@@ -21,18 +20,53 @@ Gem::Specification.new do |s|
|
|
21
20
|
s.files = [
|
22
21
|
".attic/colors.rb",
|
23
22
|
".attic/colorscheme.rb",
|
23
|
+
".attic/format-samples/1/Sweyla866607.css",
|
24
|
+
".attic/format-samples/1/Sweyla866607.tmTheme",
|
25
|
+
".attic/format-samples/1/Sweyla866607.txt",
|
26
|
+
".attic/format-samples/1/sweyla866607.el",
|
27
|
+
".attic/format-samples/1/sweyla866607.vim",
|
24
28
|
".attic/labtest.rb",
|
25
29
|
".attic/sw2.erb",
|
26
30
|
".attic/swatch.erb",
|
27
31
|
".attic/swatch3.erb",
|
28
32
|
".attic/test_swatch.rb",
|
29
33
|
".attic/test_swatch2.rb",
|
34
|
+
".helper-vimrc",
|
35
|
+
".samples/vim/colors/aphakia.vim",
|
36
|
+
".samples/vim/colors/ascian.vim",
|
37
|
+
".samples/vim/colors/bolognese.vim",
|
38
|
+
".samples/vim/colors/breeze.vim",
|
39
|
+
".samples/vim/colors/celemin.vim",
|
40
|
+
".samples/vim/colors/coquilla.vim",
|
41
|
+
".samples/vim/colors/filasse.vim",
|
42
|
+
".samples/vim/colors/gradable.vim",
|
43
|
+
".samples/vim/colors/harbinger.vim",
|
44
|
+
".samples/vim/colors/kashima.vim",
|
45
|
+
".samples/vim/colors/knockdown.vim",
|
46
|
+
".samples/vim/colors/manful.vim",
|
47
|
+
".samples/vim/colors/maximal.vim",
|
48
|
+
".samples/vim/colors/periclase.vim",
|
49
|
+
".samples/vim/colors/poesis.vim",
|
50
|
+
".samples/vim/colors/proton.vim",
|
51
|
+
".samples/vim/colors/recedence.vim",
|
52
|
+
".samples/vim/colors/scram.vim",
|
53
|
+
".samples/vim/colors/server.vim",
|
54
|
+
".samples/vim/colors/shrubbish.vim",
|
55
|
+
".samples/vim/colors/sultam.vim",
|
56
|
+
".samples/vim/colors/virtuoso.vim",
|
57
|
+
".samples/vim/colors/wherrit.vim",
|
58
|
+
".samples/vim/colors/winsome.vim",
|
59
|
+
".samples/vim/colors/wirelike.vim",
|
60
|
+
".samples/vim/syntax/actionscript.vim",
|
61
|
+
".samples/vim/syntax/erlang.vim",
|
62
|
+
".samples/vim/syntax/haxe.vim",
|
30
63
|
".yardopts",
|
31
64
|
"Gemfile",
|
32
65
|
"Gemfile.lock",
|
33
66
|
"LICENSE.txt",
|
34
67
|
"README.md",
|
35
68
|
"Rakefile",
|
69
|
+
"TODO.md",
|
36
70
|
"VERSION",
|
37
71
|
"analysis/textmate/textmate-in-the-wild.txt",
|
38
72
|
"analysis/vim/analyze-commonly-colored.sh",
|
@@ -43,11 +77,6 @@ Gem::Specification.new do |s|
|
|
43
77
|
"analysis/vim/statements.list",
|
44
78
|
"autocolors.gemspec",
|
45
79
|
"bin/autocolors",
|
46
|
-
"format-samples/1/Sweyla866607.css",
|
47
|
-
"format-samples/1/Sweyla866607.tmTheme",
|
48
|
-
"format-samples/1/Sweyla866607.txt",
|
49
|
-
"format-samples/1/sweyla866607.el",
|
50
|
-
"format-samples/1/sweyla866607.vim",
|
51
80
|
"lib/VERSION",
|
52
81
|
"lib/autocolors.rb",
|
53
82
|
"lib/autocolors/color.rb",
|
@@ -57,21 +86,16 @@ Gem::Specification.new do |s|
|
|
57
86
|
"lib/autocolors/mapping.udon",
|
58
87
|
"lib/autocolors/templates/colorscheme.erb.vim",
|
59
88
|
"notes",
|
60
|
-
"
|
61
|
-
"sample-output/chalazal.vim",
|
62
|
-
"sample-output/hello_hello.vim",
|
63
|
-
"sample-output/singsong.vim",
|
64
|
-
"sample-output/unflorid.vim",
|
65
|
-
"sample-output/upbind.vim",
|
89
|
+
"quicktest.html",
|
66
90
|
"test/helper.rb",
|
67
91
|
"test/swatch.erb",
|
68
92
|
"test/test_autocolors.rb"
|
69
93
|
]
|
70
|
-
s.homepage =
|
94
|
+
s.homepage = "http://github.com/josephwecker/autocolors"
|
71
95
|
s.licenses = ["MIT"]
|
72
96
|
s.require_paths = ["lib"]
|
73
|
-
s.rubygems_version =
|
74
|
-
s.summary =
|
97
|
+
s.rubygems_version = "1.8.10"
|
98
|
+
s.summary = "Automatically generates colorschemes (mostly for editors)."
|
75
99
|
|
76
100
|
if s.respond_to? :specification_version then
|
77
101
|
s.specification_version = 3
|
data/bin/autocolors
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
+
libdir = File.join(File.dirname(__FILE__), '..', 'lib')
|
4
|
+
if File.exists?(File.join(libdir,'autocolors.rb'))
|
5
|
+
$LOAD_PATH.unshift(libdir)
|
6
|
+
end
|
3
7
|
require 'autocolors'
|
4
8
|
|
5
9
|
colorfile = AutoColors::generate_vim_colors(ARGV[0])
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -15,15 +15,16 @@ module AutoColors
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def generate
|
18
|
-
bc = nrand(-1,
|
18
|
+
bc = nrand(-1.0,1.5,-4.0,5.5)
|
19
19
|
sat = rand * 2.0
|
20
20
|
@contrast = bc # Value between -4.0 and 5.0 used to contract/spread out intensity values
|
21
21
|
@saturation = sat # Value between 0.0 and 2.0 used to contract/intensify color values
|
22
22
|
|
23
|
-
|
24
|
-
@
|
23
|
+
#@intensity = [0.0-(bc*3.0), 20.0-(bc*2.0), 45.0-bc, 50.0, 60.0, 65.0+bc, 90.0+(bc*2.0), 110.0+(bc*3.0)]
|
24
|
+
@intensity = [[3.0 - (bc*3.0),0].max, 20.0-(bc*2.0), 45.0-bc, 50.0, 60.0, 65.0+bc, 90.0+(bc*2.0), 110.0+(bc*3.0)]
|
25
|
+
@fcolor = [0.0, 0.1*sat, 0.5*sat, 1.0*sat, 1.5*sat, 2.0*sat, 2.5*sat, 3.0*sat]
|
25
26
|
|
26
|
-
@base_colors = (1..10).map{|i| [nrand(0.0,
|
27
|
+
@base_colors = (1..10).map{|i| [nrand(0.0, 70.0, -120.0, 120.0), nrand(0.0,70.0,-120.0,120.0), 1]}
|
27
28
|
do_concrete_mapping
|
28
29
|
end
|
29
30
|
|
@@ -41,10 +42,10 @@ module AutoColors
|
|
41
42
|
ddat = entry.data.dup
|
42
43
|
fg_a, fg_b, _ = @base_colors[ldat[:fg_idx]]
|
43
44
|
bg_a, bg_b, _ = @base_colors[ldat[:bg_idx]]
|
44
|
-
ldat[:fg] = lab(light_i(ldat[:fg_intensity]), ldat[:fg_saturation], fg_a, fg_b)
|
45
|
-
ldat[:bg] = lab(light_i(ldat[:bg_intensity]), ldat[:bg_saturation], bg_a, bg_b)
|
46
|
-
ddat[:fg] = lab( dark_i(ldat[:fg_intensity]),
|
47
|
-
ddat[:bg] = lab( dark_i(ldat[:bg_intensity]),
|
45
|
+
ldat[:fg] = lab(light_i(ldat[:fg_intensity]), light_s(ldat[:fg_saturation]), fg_a, fg_b)
|
46
|
+
ldat[:bg] = lab(light_i(ldat[:bg_intensity]), light_s(ldat[:bg_saturation]), bg_a, bg_b)
|
47
|
+
ddat[:fg] = lab( dark_i(ldat[:fg_intensity]), dark_s(ldat[:fg_saturation]), fg_a, fg_b)
|
48
|
+
ddat[:bg] = lab( dark_i(ldat[:bg_intensity]), dark_s(ldat[:bg_saturation]), bg_a, bg_b)
|
48
49
|
@dark[name] = ddat
|
49
50
|
@light[name] = ldat
|
50
51
|
end
|
@@ -81,29 +82,31 @@ module AutoColors
|
|
81
82
|
c_plus = entry.data[k].count('+')
|
82
83
|
c_minus = entry.data[k].count('-')
|
83
84
|
c_neut = entry.data[k].count('~')
|
85
|
+
val = 0
|
84
86
|
if c_parent == 0
|
85
|
-
|
87
|
+
val = 3 - c_minus + c_plus
|
86
88
|
else
|
87
89
|
concrete_lvl(entry.parent, k)
|
88
90
|
offset = entry.parent.data[k]
|
89
|
-
|
91
|
+
val = offset + c_plus - c_minus
|
90
92
|
end
|
93
|
+
entry.data[k] = [[val,7].min,0].max
|
91
94
|
end
|
92
95
|
|
93
96
|
def concrete_style(entry)
|
94
97
|
entry.data[:styles] = 'NONE'
|
95
98
|
end
|
96
99
|
|
97
|
-
def dark_i(idx) idx end
|
98
|
-
def light_i(idx) 7 - idx end
|
100
|
+
def dark_i(idx) @intensity[idx] end
|
101
|
+
def light_i(idx) @intensity[7 - idx] - 0.005 end
|
102
|
+
def dark_s(idx) @fcolor[idx] end
|
103
|
+
def light_s(idx) @fcolor[idx] + 0.01 end
|
99
104
|
|
100
|
-
def lab(intensity,
|
101
|
-
Color.new([@intensity[intensity], a * @fcolor[saturation], b * @fcolor[saturation]])
|
102
|
-
end
|
105
|
+
def lab(intensity,saturation,a,b) Color.new([intensity, a * saturation, b * saturation]) end
|
103
106
|
|
104
107
|
def new_color(base_idx, diff_level, depth)
|
105
108
|
a,b,count = @base_colors[base_idx]
|
106
|
-
base_diff = (diff_level.to_f + 1.0) *
|
109
|
+
base_diff = (diff_level.to_f + 1.0) * 4.0 / ((depth.to_f + 1.0) / 2.0) * count.to_f
|
107
110
|
a_dir = rand(2) == 1 ? -1.0 : 1.0
|
108
111
|
b_dir = rand(2) == 1 ? -1.0 : 1.0
|
109
112
|
a_p = a + (base_diff * a_dir)
|
data/lib/autocolors/mapping.udon
CHANGED
@@ -4,12 +4,13 @@
|
|
4
4
|
| ignore | 1 | --- | -- | 1 | --- | -- | V | Ignore | markup.ignore * | invisible * | ?
|
5
5
|
|
6
6
|
|
7
|
-
| text | 1 | ++ |
|
7
|
+
| text | 1 | ++ | - | 1 | --- | -- | N | Normal | markup | g * | font-face??
|
8
8
|
| text.whitespace | < | < | < | <' | <- | <- | N | Whitespace | markup.whitespace * | w | ?
|
9
9
|
| text.deleted | <' | -- | <- | < | < | < | X | TextDeleted | markup.deleted * | gd | ?
|
10
10
|
| text.inserted | <' | <+ | <+ | < | < | < | N | TextInserted | markup.inserted * | gi | ?
|
11
11
|
| text.emphasis | < | < | < | < | < | < | I | TextEmphasis | markup.italic | ge | ?
|
12
12
|
| text.strong | < | < | < | < | < | < | B | TextStrong | markup.bold | gs | ?
|
13
|
+
| text.title | <' | < | < | < | < | < | U' | Title | ????? | ?????? | ???????
|
13
14
|
| text.heading | <' | <+ | <+ | < | < | < | U'I'B' | TextHeading | markup.heading | gh | ?
|
14
15
|
| text.subheading | <' | <+ | < | < | < | < | U'I'B' | TextSubheading | markup.heading.2 | gu | ?
|
15
16
|
| text.output | <' | < | < | < | < | < | N | TextOutput | markup.output * | go | ?
|
@@ -27,7 +28,7 @@
|
|
27
28
|
|
28
29
|
|
29
30
|
| lit | 2 | ++ | ~ | 1 | --- | -- | N | ? | ? | ? | ?
|
30
|
-
| lit.string | <'
|
31
|
+
| lit.string | <''| < | < | < | < | < | N | String | string | s | string-face
|
31
32
|
| lit.string.heredoc | <' | < | < | < | < | < | N | ? | string.unquoted | sh | ?
|
32
33
|
| lit.string.quoted | <' | < | < | < | < | < | N | ? | string.quoted | sx | ?
|
33
34
|
| lit.string.quoted.double | <' | < | < | < | < | < | N | ? | string.quoted.double | s2 | ?
|
@@ -35,31 +36,31 @@
|
|
35
36
|
| lit.string.quoted.backtick | <' | < | < | < | < | < | N | ? | string.quoted.backtick * | sb | ?
|
36
37
|
| lit.string.interpolated | <' | < | < | < | <- | <+ | N | ? | string.interpolated | si | ?
|
37
38
|
| lit.string.regexp | <' | < | < | < | < | < | N | ? | string.regexp | sr | ?
|
38
|
-
| lit.string.char | <'
|
39
|
+
| lit.string.char | <''| < | < | < | < | < | N | Character | constant.character | sc | ?
|
39
40
|
| lit.string.char.esc | 2' | < | <+ | < | < | < | U' | SpecialChar | constant.character.escape | se | ?
|
40
41
|
| lit.string.char.esc.unicode| <' | < | < | < | < | < | U' | ? | constant.character.escape.unicode *| ? | ?
|
41
42
|
| lit.string.char.esc.hex | <' | < | < | < | < | < | U' | ? | constant.character.escape.hex * | ? | ?
|
42
43
|
| lit.string.char.esc.oct | <' | < | < | < | < | < | U' | ? | constant.character.escape.oct * | ? | ?
|
43
44
|
|
44
45
|
| lit.number | 3 | ++ | ~ | 1 | --- | -- | N | Number | constant.numeric | m | ?
|
45
|
-
| lit.number.int | <'
|
46
|
+
| lit.number.int | <''| < | < | < | < | < | N | ? | constant.numeric.integer * | mi | ?
|
46
47
|
#| lit.number.int.hex | <' | < | < | < | < | < | N | ? | constant.numeric.integer
|
47
48
|
#| lit.number.int.oct | <' | < | < | < | < | < | N | ? |
|
48
49
|
#| lit.number.int.binary
|
49
50
|
| lit.number.int.long | <' | < | < | < | < | < | N | ? | constant.numeric.integer.long * | il | ?
|
50
51
|
| lit.number.float | <' | < | < | < | < | < | N | Float | constant.numeric.float * | mf | ?
|
51
52
|
|
52
|
-
| lit.boolean | 3'
|
53
|
-
| lit.constant | 3'
|
53
|
+
| lit.boolean | 3''| ++ | ~ | 1 | --- | -- | N | Boolean | ???? | ???? | ????
|
54
|
+
| lit.constant | 3''| ++ | - | 1 | --- | -- | N | Constant | ???? | ???? | ????
|
54
55
|
|
55
56
|
| variable | 4 | ++ | ~ | 1 | --- | -- | N | Identifier | ???? | ???? | ????
|
56
|
-
| function | 4'
|
57
|
+
| function | 4''| ++ | ~ | 1 | --- | -- | N | Function | ???? | ???? | ????
|
57
58
|
| statement | 5 | ++ | ~ | 1 | --- | -- | N | Statement | ???? | ???? | ????
|
58
|
-
| statement.conditional | <'
|
59
|
-
| statement.repeat | <'
|
60
|
-
| statement.label | <'
|
61
|
-
| statement.operator | <'
|
62
|
-
| statement.keyword | <'
|
59
|
+
| statement.conditional | <''| < | < | < | < | < | N | Conditional | ???? | ???? | ????
|
60
|
+
| statement.repeat | <''| < | < | < | < | < | N | Repeat | ???? | ???? | ????
|
61
|
+
| statement.label | <''| < | < | < | < | < | U' | Label | ???? | ???? | ????
|
62
|
+
| statement.operator | <''| < | < | < | < | < | N | Operator | ???? | ???? | ????
|
63
|
+
| statement.keyword | <''| < | < | < | < | < | N | Keyword | ???? | ???? | ????
|
63
64
|
|
64
65
|
| control.exception | 6 | ++ | ~ | 1 | ++ | + | N | Exception | ???? | ???? | ????
|
65
66
|
|
@@ -71,9 +72,9 @@
|
|
71
72
|
#| preproc.shebang |
|
72
73
|
|
73
74
|
| type | 8 | ++ | ~ | 1 | --- | -- | N | Type | ???? | ???? | ????
|
74
|
-
| type.storageclass | <'
|
75
|
-
| type.structure | <'
|
76
|
-
| type.typedef | <'
|
75
|
+
| type.storageclass | <''| < | < | < | < | < | N | StorageClass | ???? | ???? | ????
|
76
|
+
| type.structure | <''| < | < | < | < | < | N | Structure | ???? | ???? | ????
|
77
|
+
| type.typedef | <''| < | < | < | < | < | N | Typedef | ???? | ???? | ????
|
77
78
|
|
78
79
|
|
79
80
|
| delimiter | 9 | - | -- | 1 | --- | -- | N | Delimiter | ???? | ???? | ????
|
@@ -89,7 +90,7 @@
|
|
89
90
|
|
90
91
|
| ui | 1 | ++ | ~ | 1 | --- | -- | N | ? | ???? | ???? | ????
|
91
92
|
| ui.linenumbers | 1 | ~ | -- | 1 | --- | --- | N | LineNR | ???? | ???? | ????
|
92
|
-
| ui.visual | 1
|
93
|
+
| ui.visual | 1 | +++ | + | 1 | - | - | N | Visual | ???? | ???? | ????
|
93
94
|
|
94
95
|
|
95
96
|
# Special
|