autocolors 0.0.0 → 0.0.1
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/README.md +49 -1
- data/VERSION +1 -1
- data/autocolors.gemspec +22 -11
- data/bin/autocolors +12 -0
- data/lib/VERSION +1 -1
- data/lib/autocolors/{colors.rb → color.rb} +5 -5
- data/lib/autocolors/colorscheme.rb +132 -0
- data/lib/autocolors/{colorschemes.rb → colorschemes.old.rb} +0 -10
- data/lib/autocolors/mapping.rb +65 -0
- data/lib/autocolors/mapping.udon +57 -25
- data/lib/autocolors/templates/colorscheme.erb.vim +57 -0
- data/lib/autocolors.rb +14 -0
- data/sample-output/canister.vim +477 -0
- data/sample-output/chalazal.vim +477 -0
- data/sample-output/hello_hello.vim +477 -0
- data/sample-output/singsong.vim +477 -0
- data/sample-output/unflorid.vim +477 -0
- data/sample-output/upbind.vim +477 -0
- data/test/test_autocolors.rb +3 -2
- metadata +161 -102
- data/lib/autocolors/templates/colorscheme.vim +0 -64
data/README.md
CHANGED
@@ -1,4 +1,34 @@
|
|
1
|
-
|
1
|
+
# AutoColors
|
2
|
+
### Automatically create well-balanced colorschemes
|
3
|
+
|
4
|
+
## Current status
|
5
|
+
Automatically generating vim colorschemes - or at least gvim gui colorschemes.
|
6
|
+
Mappings are mostly done for textmate, pygments, and emacs, but no output for
|
7
|
+
those yet. 256 and especially 16-color palette versions are very broken at the
|
8
|
+
moment, but shouldn't be too hard to fix...
|
9
|
+
|
10
|
+
STILL EXPERIMENTAL AND CHANGING RAPIDLY. Feel free to contact me w/ suggestions
|
11
|
+
& questions.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
$ autocolors [COLORSCHEME_NAME]
|
16
|
+
|
17
|
+
Generates a name for you if left blank - saves it to colorscheme\_name.vim in your
|
18
|
+
cwd. I know, not very flexible. If you're really curious about how beautiful
|
19
|
+
these are though, you can do this:
|
20
|
+
|
21
|
+
$ cd ~/.vim/colors
|
22
|
+
$ autocolors
|
23
|
+
$ autocolors
|
24
|
+
$ autocolors
|
25
|
+
... muahahaha ...
|
26
|
+
|
27
|
+
Important: These syntax files honor the background variable! So if in your
|
28
|
+
.vimrc file (or whatever) you do "set background=light" or dark, you'll get the
|
29
|
+
light or dark version of the colorscheme.
|
30
|
+
|
31
|
+
## Quick notes
|
2
32
|
|
3
33
|
* Palettes for ( mono / 16 / 256 / ffffff )
|
4
34
|
* Outputs for
|
@@ -17,3 +47,21 @@ Automatically create well-balanced colorschemes
|
|
17
47
|
* Properly balanced for transitions across semantics/syntax/focuses
|
18
48
|
* Really good looking
|
19
49
|
* Random. muahaha
|
50
|
+
|
51
|
+
## Contributing to autocolors
|
52
|
+
|
53
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
54
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
55
|
+
* Fork the project
|
56
|
+
* Start a feature/bugfix branch
|
57
|
+
* Commit and push until you are happy with your contribution
|
58
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
59
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to
|
60
|
+
have your own version, or is otherwise necessary, that is fine, but please
|
61
|
+
isolate to its own commit so I can cherry-pick around it.
|
62
|
+
|
63
|
+
## Copyright / License
|
64
|
+
|
65
|
+
Copyright (c) 2011 Joseph Wecker.
|
66
|
+
See LICENSE.txt for further details. (MIT License)
|
67
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/autocolors.gemspec
CHANGED
@@ -4,14 +4,16 @@
|
|
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 = %q{autocolors}
|
8
|
+
s.version = "0.0.1"
|
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.
|
12
|
+
s.date = %q{2011-09-13}
|
13
|
+
s.default_executable = %q{autocolors}
|
14
|
+
s.description = %q{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.}
|
15
|
+
s.email = %q{joseph.wecker@gmail.com}
|
16
|
+
s.executables = ["autocolors"]
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"LICENSE.txt",
|
17
19
|
"README.md"
|
@@ -40,6 +42,7 @@ Gem::Specification.new do |s|
|
|
40
42
|
"analysis/vim/gather.sh",
|
41
43
|
"analysis/vim/statements.list",
|
42
44
|
"autocolors.gemspec",
|
45
|
+
"bin/autocolors",
|
43
46
|
"format-samples/1/Sweyla866607.css",
|
44
47
|
"format-samples/1/Sweyla866607.tmTheme",
|
45
48
|
"format-samples/1/Sweyla866607.txt",
|
@@ -47,20 +50,28 @@ Gem::Specification.new do |s|
|
|
47
50
|
"format-samples/1/sweyla866607.vim",
|
48
51
|
"lib/VERSION",
|
49
52
|
"lib/autocolors.rb",
|
50
|
-
"lib/autocolors/
|
51
|
-
"lib/autocolors/
|
53
|
+
"lib/autocolors/color.rb",
|
54
|
+
"lib/autocolors/colorscheme.rb",
|
55
|
+
"lib/autocolors/colorschemes.old.rb",
|
56
|
+
"lib/autocolors/mapping.rb",
|
52
57
|
"lib/autocolors/mapping.udon",
|
53
|
-
"lib/autocolors/templates/colorscheme.vim",
|
58
|
+
"lib/autocolors/templates/colorscheme.erb.vim",
|
54
59
|
"notes",
|
60
|
+
"sample-output/canister.vim",
|
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",
|
55
66
|
"test/helper.rb",
|
56
67
|
"test/swatch.erb",
|
57
68
|
"test/test_autocolors.rb"
|
58
69
|
]
|
59
|
-
s.homepage =
|
70
|
+
s.homepage = %q{http://github.com/josephwecker/autocolors}
|
60
71
|
s.licenses = ["MIT"]
|
61
72
|
s.require_paths = ["lib"]
|
62
|
-
s.rubygems_version =
|
63
|
-
s.summary =
|
73
|
+
s.rubygems_version = %q{1.6.2}
|
74
|
+
s.summary = %q{Automatically generates colorschemes (mostly for editors).}
|
64
75
|
|
65
76
|
if s.respond_to? :specification_version then
|
66
77
|
s.specification_version = 3
|
data/bin/autocolors
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'autocolors'
|
4
|
+
|
5
|
+
colorfile = AutoColors::generate_vim_colors(ARGV[0])
|
6
|
+
|
7
|
+
name = colorfile.match(/^" ([A-Z0-9_-]+)/u)[1].downcase
|
8
|
+
|
9
|
+
fname = name + '.vim'
|
10
|
+
|
11
|
+
File.open(fname,'w+'){|f| f.write(colorfile)}
|
12
|
+
$stderr.puts "Wrote new syntax file: #{fname}"
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'matrix'
|
2
2
|
|
3
|
-
module
|
3
|
+
module AutoColors
|
4
4
|
LRGB2XYZ = Matrix[[0.4124,0.3576,0.1805],[0.2126,0.7152,0.0722],[0.0193,0.1192,0.9505]]
|
5
5
|
XYZ2LRGB = Matrix[[3.2406,-1.5372,-0.4986],[-0.9689,1.8758,0.0415],[0.0557,-0.2040,1.0570]]
|
6
6
|
|
@@ -119,16 +119,16 @@ module Colors
|
|
119
119
|
[0xa8,0xa8,0xa8],[0xb2,0xb2,0xb2],[0xbc,0xbc,0xbc],[0xc6,0xc6,0xc6],
|
120
120
|
[0xd0,0xd0,0xd0],[0xda,0xda,0xda],[0xe4,0xe4,0xe4],[0xee,0xee,0xee]]
|
121
121
|
|
122
|
-
CUBE256 = CUBE256_8NORM.map {|rgb|
|
123
|
-
CUBE256_BRIGHT.map{|rgb|
|
122
|
+
CUBE256 = CUBE256_8NORM.map {|rgb| Color.new(rgb)} +
|
123
|
+
CUBE256_BRIGHT.map{|rgb| Color.new(rgb)} +
|
124
124
|
(0..(6*6*6 - 1)).map do |i|
|
125
125
|
b = i % 6; i = (i - b) / 6
|
126
126
|
g = i % 6; i = (i - g) / 6
|
127
|
-
|
127
|
+
Color.new([CUBE256_STEPS[i % 6],
|
128
128
|
CUBE256_STEPS[g],
|
129
129
|
CUBE256_STEPS[b]])
|
130
130
|
end +
|
131
|
-
CUBE256_GRAYS.map{|rgb|
|
131
|
+
CUBE256_GRAYS.map{|rgb| Color.new(rgb)}
|
132
132
|
|
133
133
|
class Color
|
134
134
|
def to_256
|
@@ -0,0 +1,132 @@
|
|
1
|
+
module AutoColors
|
2
|
+
class ColorScheme
|
3
|
+
require 'webster'
|
4
|
+
require 'autocolors/color'
|
5
|
+
attr_accessor :name, :seed, :contrast, :saturation, :dark, :light
|
6
|
+
def initialize(name=nil)
|
7
|
+
srand rand(0xffffffff)
|
8
|
+
name ||= Webster.new.random_word
|
9
|
+
@name = name
|
10
|
+
@seed = @name.hash
|
11
|
+
srand @seed
|
12
|
+
@dark = {}
|
13
|
+
@light = {}
|
14
|
+
generate
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate
|
18
|
+
bc = nrand(-1,2,-4,5)
|
19
|
+
sat = rand * 2.0
|
20
|
+
@contrast = bc # Value between -4.0 and 5.0 used to contract/spread out intensity values
|
21
|
+
@saturation = sat # Value between 0.0 and 2.0 used to contract/intensify color values
|
22
|
+
|
23
|
+
@intensity = [00-(bc*3), 20-(bc*2), 45-bc, 50, 60, 65+bc, 90+(bc*2), 110+(bc*3)]
|
24
|
+
@fcolor = [0.0, 0.1*sat, 0.2*sat, 0.4*sat, 0.8*sat, 1.6*sat, 3.2*sat, 6.4*sat]
|
25
|
+
|
26
|
+
@base_colors = (1..10).map{|i| [nrand(0.0, 100.0, -120.0, 120.0), nrand(0.0,100.0,-120.0,120.0), 1]}
|
27
|
+
do_concrete_mapping
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
def do_concrete_mapping
|
32
|
+
@mapping = MAPPING.dup
|
33
|
+
@mapping.entries.each do |name, entry|
|
34
|
+
[:fg_idx, :bg_idx].each{|k| concrete_index(entry,k)}
|
35
|
+
[:fg_intensity, :fg_saturation, :bg_intensity, :bg_saturation].each{|k| concrete_lvl(entry,k)}
|
36
|
+
concrete_style(entry)
|
37
|
+
end
|
38
|
+
|
39
|
+
@mapping.entries.each do |name, entry|
|
40
|
+
ldat = entry.data.dup
|
41
|
+
ddat = entry.data.dup
|
42
|
+
fg_a, fg_b, _ = @base_colors[ldat[:fg_idx]]
|
43
|
+
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]), ldat[:fg_saturation], fg_a, fg_b)
|
47
|
+
ddat[:bg] = lab( dark_i(ldat[:bg_intensity]), ldat[:bg_saturation], bg_a, bg_b)
|
48
|
+
@dark[name] = ddat
|
49
|
+
@light[name] = ldat
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def concrete_index(entry, k)
|
54
|
+
return if entry.data[k].is_a? Integer
|
55
|
+
primes = entry.data[k].count("'")
|
56
|
+
entry.data[k].gsub! "'",''
|
57
|
+
if entry.data[k] =~ /^(\d+)$/ # Direct index
|
58
|
+
if primes > 0
|
59
|
+
entry.data[k] = new_color(Integer($1), primes, entry.depth)
|
60
|
+
else # Otherwise good to go
|
61
|
+
entry.data[k] = Integer($1)
|
62
|
+
end
|
63
|
+
elsif entry.data[k] =~ /^<$/ # Inherit from parent
|
64
|
+
if entry.parent.nil?
|
65
|
+
$stderr.puts "Mapping refers to parent without having a parent"
|
66
|
+
exit(2)
|
67
|
+
else
|
68
|
+
concrete_index(entry.parent, k)
|
69
|
+
if primes == 0 # Directly inherit
|
70
|
+
entry.data[k] = entry.parent.data[k]
|
71
|
+
else # Modify a bit
|
72
|
+
entry.data[k] = new_color(entry.parent.data[k], primes, entry.depth)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def concrete_lvl(entry, k)
|
79
|
+
return if entry.data[k].is_a? Integer
|
80
|
+
c_parent = entry.data[k].count('<')
|
81
|
+
c_plus = entry.data[k].count('+')
|
82
|
+
c_minus = entry.data[k].count('-')
|
83
|
+
c_neut = entry.data[k].count('~')
|
84
|
+
if c_parent == 0
|
85
|
+
entry.data[k] = 3 - c_minus + c_plus
|
86
|
+
else
|
87
|
+
concrete_lvl(entry.parent, k)
|
88
|
+
offset = entry.parent.data[k]
|
89
|
+
entry.data[k] = offset + c_plus - c_minus
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def concrete_style(entry)
|
94
|
+
entry.data[:styles] = 'NONE'
|
95
|
+
end
|
96
|
+
|
97
|
+
def dark_i(idx) idx end
|
98
|
+
def light_i(idx) 7 - idx end
|
99
|
+
|
100
|
+
def lab(intensity, saturation, a, b)
|
101
|
+
Color.new([@intensity[intensity], a * @fcolor[saturation], b * @fcolor[saturation]])
|
102
|
+
end
|
103
|
+
|
104
|
+
def new_color(base_idx, diff_level, depth)
|
105
|
+
a,b,count = @base_colors[base_idx]
|
106
|
+
base_diff = (diff_level.to_f + 1.0) * 10.0 / ((depth.to_f + 1.0) / 2.0) * count.to_f
|
107
|
+
a_dir = rand(2) == 1 ? -1.0 : 1.0
|
108
|
+
b_dir = rand(2) == 1 ? -1.0 : 1.0
|
109
|
+
a_p = a + (base_diff * a_dir)
|
110
|
+
b_p = b + (base_diff * b_dir)
|
111
|
+
new_idx = @base_colors.size
|
112
|
+
@base_colors[new_idx] = [a_p, b_p, 1]
|
113
|
+
@base_colors[base_idx][2] += 1
|
114
|
+
return new_idx
|
115
|
+
end
|
116
|
+
|
117
|
+
def rand_color; rand(180) - 90 end
|
118
|
+
def nrand_color; nrand(0.0, 40.0, -120.0, 120.0) end
|
119
|
+
|
120
|
+
def nrand(mean=0, stddev=nil, floor=nil, ceil=nil)
|
121
|
+
theta = 2 * Math::PI * rand
|
122
|
+
rho = Math.sqrt(-2 * Math.log(1 - rand))
|
123
|
+
scale = stddev * rho
|
124
|
+
res = (rand >= 0.5) ? Math.cos(theta) : Math.sin(theta)
|
125
|
+
res = mean.to_f + scale * res
|
126
|
+
res = floor if (! floor.nil?) && (res < floor)
|
127
|
+
res = ceil if (! ceil.nil?) && (res > ceil)
|
128
|
+
return res
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
@@ -102,16 +102,6 @@ class ColorScheme
|
|
102
102
|
res = ceil if (! ceil.nil?) && (res > ceil)
|
103
103
|
return res
|
104
104
|
end
|
105
|
-
|
106
|
-
def curve(start,count,step=1.0)
|
107
|
-
gr = (1.0 + Math.sqrt(5))
|
108
|
-
res = [start]
|
109
|
-
(1..count-1).each do |i|
|
110
|
-
start *= (gr ** step)
|
111
|
-
res << start / 2.0
|
112
|
-
end
|
113
|
-
return res
|
114
|
-
end
|
115
105
|
end
|
116
106
|
|
117
107
|
#schemes = (0..100).map{ColorScheme.new}.sort_by{|c|c.contrast}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module AutoColors
|
2
|
+
KEYS = [:fg_idx, :fg_intensity, :fg_saturation,
|
3
|
+
:bg_idx, :bg_intensity, :bg_saturation, :styles,
|
4
|
+
:to_vim, :to_textmate, :to_pygments, :to_emacs]
|
5
|
+
|
6
|
+
class MapEntry
|
7
|
+
attr_accessor :name, :data, :parent, :children
|
8
|
+
def initialize(name, data)
|
9
|
+
@name = name
|
10
|
+
@data = data
|
11
|
+
@parent = nil
|
12
|
+
@children = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def depth
|
16
|
+
@name.count('.')
|
17
|
+
end
|
18
|
+
|
19
|
+
def children_size
|
20
|
+
@children.size + @children.reduce(0){|t,c| t + c.children_size}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Mapping
|
25
|
+
attr_accessor :entries
|
26
|
+
def initialize
|
27
|
+
map_name = File.dirname(__FILE__) + '/mapping.udon'
|
28
|
+
@entries = {}
|
29
|
+
parse_map(IO.readlines(map_name))
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse_map(lines)
|
33
|
+
lines.each_with_index do |row,i|
|
34
|
+
cols = row.gsub(/#.*/,'').strip.split(/\|/u).map{|c| c.strip}
|
35
|
+
next if cols.size == 0
|
36
|
+
if cols.size < 13
|
37
|
+
$stderr.puts("Warning - incomplete mapping line #{i+1} of mapping.udon.")
|
38
|
+
next
|
39
|
+
end
|
40
|
+
cols.shift # blank from leading pipe
|
41
|
+
name = cols.shift
|
42
|
+
@entries[name] = MapEntry.new(name, Hash[*KEYS.zip(cols).flatten])
|
43
|
+
end
|
44
|
+
parse_values
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_values
|
48
|
+
@entries.each do |name, entry|
|
49
|
+
name_parts = name.split('.')
|
50
|
+
if name_parts.size > 1
|
51
|
+
localpart = name_parts.pop
|
52
|
+
parent_key = name_parts.join('.')
|
53
|
+
if ! @entries.has_key?(parent_key)
|
54
|
+
$stderr.puts("Warning - skipping entry #{name} because #{parent_key} not found.")
|
55
|
+
@entries.delete(name)
|
56
|
+
next
|
57
|
+
end
|
58
|
+
entry.parent = @entries[parent_key]
|
59
|
+
entry.parent.children << entry
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
MAPPING = Mapping.new
|
65
|
+
end
|
data/lib/autocolors/mapping.udon
CHANGED
@@ -5,19 +5,19 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
| text | 1 | ++ | ~ | 1 | --- | -- | N | Normal | markup | g * | font-face??
|
8
|
-
| text.whitespace | < | < | < | <' | <- | <- | N | Whitespace
|
9
|
-
| text.deleted | <' | -- | <- | < | < | < | X | TextDeleted
|
10
|
-
| text.inserted | <' | <+ | <+ | < | < | < | N | TextInserted
|
11
|
-
| text.emphasis | < | < | < | < | < | < | I | TextEmphasis
|
12
|
-
| text.strong | < | < | < | < | < | < | B | TextStrong
|
13
|
-
| text.heading | <' | <+ | <+ | < | < | < | U'I'B' | TextHeading
|
14
|
-
| text.subheading | <' | <+ | < | < | < | < | U'I'B' | TextSubheading
|
15
|
-
| text.output | <' | < | < | < | < | < | N | TextOutput
|
8
|
+
| text.whitespace | < | < | < | <' | <- | <- | N | Whitespace | markup.whitespace * | w | ?
|
9
|
+
| text.deleted | <' | -- | <- | < | < | < | X | TextDeleted | markup.deleted * | gd | ?
|
10
|
+
| text.inserted | <' | <+ | <+ | < | < | < | N | TextInserted | markup.inserted * | gi | ?
|
11
|
+
| text.emphasis | < | < | < | < | < | < | I | TextEmphasis | markup.italic | ge | ?
|
12
|
+
| text.strong | < | < | < | < | < | < | B | TextStrong | markup.bold | gs | ?
|
13
|
+
| text.heading | <' | <+ | <+ | < | < | < | U'I'B' | TextHeading | markup.heading | gh | ?
|
14
|
+
| text.subheading | <' | <+ | < | < | < | < | U'I'B' | TextSubheading | markup.heading.2 | gu | ?
|
15
|
+
| text.output | <' | < | < | < | < | < | N | TextOutput | markup.output * | go | ?
|
16
16
|
|
17
17
|
|
18
18
|
| comment | 1' | - | -- | 1 | --- | -- | I' | Comment | comment | c | comment-face
|
19
|
-
| comment.inline | <' | < | < | < | < | < | I' | CommentInline
|
20
|
-
| comment.multiline | <' | < | < | < | < | < | I' | CommentBlock
|
19
|
+
| comment.inline | <' | < | < | < | < | < | I' | CommentInline | comment.line | c1 | ?
|
20
|
+
| comment.multiline | <' | < | < | < | < | < | I' | CommentBlock | comment.block | cm | ?
|
21
21
|
| comment.special | <' | <+ | <+ | < | < | < | I'B' | SpecialComment | comment.block.documentation | cs | ?
|
22
22
|
|
23
23
|
| documentation | 1''| ++ | ~ | 1 | --- | -- | N | ? | comment.block.documentation | sd | doc-face + doc-string-face
|
@@ -26,9 +26,8 @@
|
|
26
26
|
| documentation.version | <' | < | < | < | < | < | N | ? | comment.version * | v | ?
|
27
27
|
|
28
28
|
|
29
|
-
|
|
30
|
-
|
31
|
-
| lit.string | 2' | ++ | ~ | 1 | --- | -- | N | String | string | s | string-face
|
29
|
+
| lit | 2 | ++ | ~ | 1 | --- | -- | N | ? | ? | ? | ?
|
30
|
+
| lit.string | <' | < | < | < | < | < | N | String | string | s | string-face
|
32
31
|
| lit.string.heredoc | <' | < | < | < | < | < | N | ? | string.unquoted | sh | ?
|
33
32
|
| lit.string.quoted | <' | < | < | < | < | < | N | ? | string.quoted | sx | ?
|
34
33
|
| lit.string.quoted.double | <' | < | < | < | < | < | N | ? | string.quoted.double | s2 | ?
|
@@ -37,28 +36,61 @@
|
|
37
36
|
| lit.string.interpolated | <' | < | < | < | <- | <+ | N | ? | string.interpolated | si | ?
|
38
37
|
| lit.string.regexp | <' | < | < | < | < | < | N | ? | string.regexp | sr | ?
|
39
38
|
| lit.string.char | <' | < | < | < | < | < | N | Character | constant.character | sc | ?
|
40
|
-
| lit.string.char.esc | 2' | <+ | <
|
39
|
+
| lit.string.char.esc | 2' | < | <+ | < | < | < | U' | SpecialChar | constant.character.escape | se | ?
|
41
40
|
| lit.string.char.esc.unicode| <' | < | < | < | < | < | U' | ? | constant.character.escape.unicode *| ? | ?
|
42
41
|
| lit.string.char.esc.hex | <' | < | < | < | < | < | U' | ? | constant.character.escape.hex * | ? | ?
|
43
42
|
| lit.string.char.esc.oct | <' | < | < | < | < | < | U' | ? | constant.character.escape.oct * | ? | ?
|
44
43
|
|
45
44
|
| lit.number | 3 | ++ | ~ | 1 | --- | -- | N | Number | constant.numeric | m | ?
|
46
45
|
| lit.number.int | <' | < | < | < | < | < | N | ? | constant.numeric.integer * | mi | ?
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
#| lit.number.int.hex | <' | < | < | < | < | < | N | ? | constant.numeric.integer
|
47
|
+
#| lit.number.int.oct | <' | < | < | < | < | < | N | ? |
|
48
|
+
#| lit.number.int.binary
|
50
49
|
| lit.number.int.long | <' | < | < | < | < | < | N | ? | constant.numeric.integer.long * | il | ?
|
51
50
|
| lit.number.float | <' | < | < | < | < | < | N | Float | constant.numeric.float * | mf | ?
|
52
51
|
|
53
|
-
|
|
52
|
+
| lit.boolean | 3' | ++ | ~ | 1 | --- | -- | N | Boolean | ???? | ???? | ????
|
53
|
+
| lit.constant | 3' | ++ | - | 1 | --- | -- | N | Constant | ???? | ???? | ????
|
54
|
+
|
55
|
+
| variable | 4 | ++ | ~ | 1 | --- | -- | N | Identifier | ???? | ???? | ????
|
56
|
+
| function | 4' | ++ | ~ | 1 | --- | -- | N | Function | ???? | ???? | ????
|
57
|
+
| statement | 5 | ++ | ~ | 1 | --- | -- | N | Statement | ???? | ???? | ????
|
58
|
+
| statement.conditional | <' | < | < | < | < | < | N | Conditional | ???? | ???? | ????
|
59
|
+
| statement.repeat | <' | < | < | < | < | < | N | Repeat | ???? | ???? | ????
|
60
|
+
| statement.label | <' | < | < | < | < | < | U' | Label | ???? | ???? | ????
|
61
|
+
| statement.operator | <' | < | < | < | < | < | N | Operator | ???? | ???? | ????
|
62
|
+
| statement.keyword | <' | < | < | < | < | < | N | Keyword | ???? | ???? | ????
|
63
|
+
|
64
|
+
| control.exception | 6 | ++ | ~ | 1 | ++ | + | N | Exception | ???? | ???? | ????
|
65
|
+
|
66
|
+
| preproc | 7 | ++ | ~ | 1 | --- | -- | N | PreProc | ???? | ???? | ????
|
67
|
+
| preproc.include | <' | < | < | < | < | < | N | Include | ???? | ???? | ????
|
68
|
+
| preproc.define | <' | < | < | < | < | < | N | Define | ???? | ???? | ????
|
69
|
+
| preproc.macro | <' | < | < | < | < | < | N | Macro | ???? | ???? | ????
|
70
|
+
| preproc.precondition | <' | < | < | < | < | < | N | PreCondit | ???? | ???? | ????
|
71
|
+
#| preproc.shebang |
|
72
|
+
|
73
|
+
| type | 8 | ++ | ~ | 1 | --- | -- | N | Type | ???? | ???? | ????
|
74
|
+
| type.storageclass | <' | < | < | < | < | < | N | StorageClass | ???? | ???? | ????
|
75
|
+
| type.structure | <' | < | < | < | < | < | N | Structure | ???? | ???? | ????
|
76
|
+
| type.typedef | <' | < | < | < | < | < | N | Typedef | ???? | ???? | ????
|
77
|
+
|
78
|
+
|
79
|
+
| delimiter | 9 | - | -- | 1 | --- | -- | N | Delimiter | ???? | ???? | ????
|
80
|
+
#| delimiter.comment | ? | ? | ? | comment-delimiter-face
|
81
|
+
#| delimiter.heredoc
|
82
|
+
#| delimiter.string
|
83
|
+
#| delimiter.string.escape
|
54
84
|
|
85
|
+
| debug | 6' | ++ | ++ | 1' | -- | - | N | Debug | ???? | ???? | ????
|
86
|
+
| debug.error | <' | < | < | < | < | < | N | Error | ???? | ???? | ????
|
87
|
+
#| debug.errormsg | | | gr
|
88
|
+
#| debug.traceback | | | gt
|
55
89
|
|
56
|
-
|
|
57
|
-
|
|
90
|
+
| ui | 1 | ++ | ~ | 1 | --- | -- | N | ? | ???? | ???? | ????
|
91
|
+
| ui.linenumbers | 1 | ~ | -- | 1 | --- | --- | N | LineNR | ???? | ???? | ????
|
92
|
+
| ui.visual | 1' | ++ | ~ | 1' | -- | - | N | Visual | ???? | ???? | ????
|
58
93
|
|
59
94
|
|
60
|
-
|
61
|
-
|
62
|
-
| delimiter.heredoc
|
63
|
-
| delimiter.string
|
64
|
-
| delimiter.string.escape
|
95
|
+
# Special
|
96
|
+
# Tag
|
@@ -0,0 +1,57 @@
|
|
1
|
+
" <%= scheme.name.upcase %>
|
2
|
+
" -----------------------------------------------------------------------------
|
3
|
+
" Vim color file
|
4
|
+
" Generated automatically by autocolors version <%= VERSION %>
|
5
|
+
" https://github.com/josephwecker/autocolors
|
6
|
+
" Public Domain
|
7
|
+
" -----------------------------------------------------------------------------
|
8
|
+
|
9
|
+
if version > 580
|
10
|
+
hi clear
|
11
|
+
if exists("syntax_on")
|
12
|
+
syntax reset
|
13
|
+
endif
|
14
|
+
endif
|
15
|
+
|
16
|
+
"let g:colors_name = expand('<sfile>:t:r')
|
17
|
+
let g:colors_name = '<%= scheme.name %>'
|
18
|
+
|
19
|
+
if has("gui_running") || &t_Co > 16
|
20
|
+
if &background == "light"
|
21
|
+
<%- c = scheme.light -%>
|
22
|
+
<%- c.each do |name, data| -%>
|
23
|
+
<%- if data[:to_vim] != '?' -%>
|
24
|
+
hi <%= data[:to_vim] %> cterm=<%=data[:styles] %> gui=<%=data[:styles] %>
|
25
|
+
hi <%= data[:to_vim] %> ctermbg=<%=data[:bg].to_256 %> ctermfg=<%= data[:fg].to_256 %>
|
26
|
+
hi <%= data[:to_vim] %> guifg=<%=data[:fg] %> guibg=<%=data[:bg] %>
|
27
|
+
<%- end -%>
|
28
|
+
<%- end -%>
|
29
|
+
else
|
30
|
+
<%- c = scheme.dark -%>
|
31
|
+
<%- c.each do |name, data| -%>
|
32
|
+
<%- if data[:to_vim] != '?' -%>
|
33
|
+
hi <%= data[:to_vim] %> cterm=<%=data[:styles] %> gui=<%=data[:styles] %>
|
34
|
+
hi <%= data[:to_vim] %> ctermbg=<%=data[:bg].to_256 %> ctermfg=<%= data[:fg].to_256 %>
|
35
|
+
hi <%= data[:to_vim] %> guifg=<%=data[:fg] %> guibg=<%=data[:bg]%>
|
36
|
+
<%- end -%>
|
37
|
+
<%- end -%>
|
38
|
+
endif
|
39
|
+
else
|
40
|
+
if &background == "light"
|
41
|
+
<%- c = scheme.light -%>
|
42
|
+
<%- c.each do |name, data| -%>
|
43
|
+
<%- if data[:to_vim] != '?' -%>
|
44
|
+
hi <%= data[:to_vim] %> term=<%=data[:styles] %> cterm=<%=data[:styles] %>
|
45
|
+
hi <%= data[:to_vim] %> ctermbg=<%=data[:bg].to_16%> ctermfg=<%=data[:fg].to_16%>
|
46
|
+
<%- end -%>
|
47
|
+
<%- end -%>
|
48
|
+
else
|
49
|
+
<%- c = scheme.dark -%>
|
50
|
+
<%- c.each do |name, data| -%>
|
51
|
+
<%- if data[:to_vim] != '?' -%>
|
52
|
+
hi <%= data[:to_vim] %> term=<%=data[:styles] %> cterm=<%=data[:styles] %>
|
53
|
+
hi <%= data[:to_vim] %> ctermbg=<%=data[:bg].to_16%> ctermfg=<%=data[:fg].to_16%>
|
54
|
+
<%- end -%>
|
55
|
+
<%- end -%>
|
56
|
+
endif
|
57
|
+
endif
|
data/lib/autocolors.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
module AutoColors
|
2
|
+
require 'autocolors/mapping'
|
3
|
+
require 'autocolors/colorscheme'
|
4
|
+
require 'erb'
|
2
5
|
VERSION = File.exist?(File.join(File.dirname(__FILE__),'VERSION')) ? File.read(File.join(File.dirname(__FILE__),'VERSION')) : ""
|
6
|
+
TEMPLATE_PATH = File.join(File.dirname(__FILE__),'autocolors','templates')
|
3
7
|
class << self
|
4
8
|
def version() VERSION end
|
9
|
+
|
10
|
+
def template(name)
|
11
|
+
IO.read(File.join(TEMPLATE_PATH, name))
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate_vim_colors(name=nil)
|
15
|
+
scheme = ColorScheme.new(name)
|
16
|
+
template = ERB.new(template('colorscheme.erb.vim'),nil,'-')
|
17
|
+
return template.result(binding)
|
18
|
+
end
|
5
19
|
end
|
6
20
|
end
|