rmthemegen 0.0.23 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,20 +2,24 @@ rmthemegen - A syntax color theme generator for IntelliJ's Rubymine IDE
2
2
 
3
3
  By David Heitzman
4
4
  evolvemeans@gmail.com
5
- released under the MIT license "free to use"
5
+ released under an MIT-style license, see license.txt for details
6
6
 
7
7
  "This software is not designed to diagnose, treat, or cure any particular ailment. Except bad color schemes. "
8
8
 
9
9
  requirements :
10
- ruby : >= 1.9.1
10
+ ruby : >= 1.8.7
11
11
  gems:
12
12
  color
13
13
  xml-simple
14
14
 
15
- usage: <rmthemegem gem directory>/bin/generate_themes
15
+ usage: ruby <rmthemegem gem directory>/bin/generate_themes.rb
16
+
16
17
  It will generate 1 or more files called: "<rmthemegen gem directory/generated_themes/rmt_something_something.xml"
17
- Place these in your ./RubyMine/config/colors directory and then go to File/Settings/Editor/Colors&Fonts
18
- you should see your newly generated theme(s) listed there.
18
+
19
+ Place these in your ./RubyMine/config/colors directory and then in the RubyMine IDE,
20
+ go to File/Settings/Editor/Colors&Fonts
21
+
22
+ You should see your newly generated theme(s) listed there.
19
23
 
20
24
 
21
25
 
@@ -0,0 +1,279 @@
1
+ #--
2
+ # Color
3
+ # Colour management with Ruby
4
+ # http://rubyforge.org/projects/color
5
+ # Version 1.4.1
6
+ #
7
+ # Licensed under a MIT-style licence. See Licence.txt in the main
8
+ # distribution for full licensing information.
9
+ #
10
+ # Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
11
+ #++
12
+
13
+ # An CMYK colour object. CMYK (cyan, magenta, yellow, and black) colours are
14
+ # based on additive percentages of ink. A CMYK colour of (0.3, 0, 0.8, 0.3)
15
+ # would be mixed from 30% cyan, 0% magenta, 80% yellow, and 30% black.
16
+ # Primarily used in four-colour printing processes.
17
+ class Color::CMYK
18
+ # The format of a DeviceCMYK colour for PDF. In color-tools 2.0 this will
19
+ # be removed from this package and added back as a modification by the
20
+ # PDF::Writer package.
21
+ PDF_FORMAT_STR = "%.3f %.3f %.3f %.3f %s"
22
+
23
+ # Compares the other colour to this one. The other colour will be
24
+ # converted to CMYK before comparison, so the comparison between a CMYK
25
+ # colour and a non-CMYK colour will be approximate and based on the other
26
+ # colour's #to_cmyk conversion. If there is no #to_cmyk conversion, this
27
+ # will raise an exception. This will report that two CMYK colours are
28
+ # equivalent if all component values are within COLOR_TOLERANCE of each
29
+ # other.
30
+ def ==(other)
31
+ other = other.to_cmyk
32
+ other.kind_of?(Color::CMYK) and
33
+ ((@c - other.c).abs <= Color::COLOR_TOLERANCE) and
34
+ ((@m - other.m).abs <= Color::COLOR_TOLERANCE) and
35
+ ((@y - other.y).abs <= Color::COLOR_TOLERANCE) and
36
+ ((@k - other.k).abs <= Color::COLOR_TOLERANCE)
37
+ end
38
+
39
+ # Creates a CMYK colour object from fractional values 0..1.
40
+ #
41
+ # Color::CMYK.from_fraction(0.3, 0, 0.8, 0.3)
42
+ def self.from_fraction(c = 0, m = 0, y = 0, k = 0)
43
+ colour = Color::CMYK.new
44
+ colour.c = c
45
+ colour.m = m
46
+ colour.y = y
47
+ colour.k = k
48
+ colour
49
+ end
50
+
51
+ # Creates a CMYK colour object from percentages. Internally, the colour is
52
+ # managed as fractional values 0..1.
53
+ #
54
+ # Color::CMYK.new(30, 0, 80, 30)
55
+ def self.from_percent(c = 0, m = 0, y = 0, k = 0)
56
+ Color::CMYK.new(c, m, y, k)
57
+ end
58
+
59
+ # Creates a CMYK colour object from percentages. Internally, the colour is
60
+ # managed as fractional values 0..1.
61
+ #
62
+ # Color::CMYK.new(30, 0, 80, 30)
63
+ def initialize(c = 0, m = 0, y = 0, k = 0)
64
+ @c = c / 100.0
65
+ @m = m / 100.0
66
+ @y = y / 100.0
67
+ @k = k / 100.0
68
+ end
69
+
70
+ # Present the colour as a DeviceCMYK fill colour string for PDF. This will
71
+ # be removed from the default package in color-tools 2.0.
72
+ def pdf_fill
73
+ PDF_FORMAT_STR % [ @c, @m, @y, @k, "k" ]
74
+ end
75
+
76
+ # Present the colour as a DeviceCMYK stroke colour string for PDF. This
77
+ # will be removed from the default package in color-tools 2.0.
78
+ def pdf_stroke
79
+ PDF_FORMAT_STR % [ @c, @m, @y, @k, "K" ]
80
+ end
81
+
82
+ # Present the colour as an RGB HTML/CSS colour string (e.g., "#aabbcc").
83
+ # Note that this will perform a #to_rgb operation using the default
84
+ # conversion formula.
85
+ def html
86
+ to_rgb.html
87
+ end
88
+
89
+ # Present the colour as an RGB HTML/CSS colour string (e.g., "rgb(0%, 50%,
90
+ # 100%)"). Note that this will perform a #to_rgb operation using the
91
+ # default conversion formula.
92
+ def css_rgb
93
+ to_rgb.css_rgb
94
+ end
95
+
96
+ # Present the colour as an RGBA (with alpha) HTML/CSS colour string (e.g.,
97
+ # "rgb(0%, 50%, 100%, 1)"). Note that this will perform a #to_rgb
98
+ # operation using the default conversion formula.
99
+ def css_rgba
100
+ to_rgb.css_rgba
101
+ end
102
+
103
+ # Present the colour as an HSL HTML/CSS colour string (e.g., "hsl(180,
104
+ # 25%, 35%)"). Note that this will perform a #to_hsl operation using the
105
+ # default conversion formula.
106
+ def css_hsl
107
+ to_hsl.css_hsl
108
+ end
109
+
110
+ # Present the colour as an HSLA (with alpha) HTML/CSS colour string (e.g.,
111
+ # "hsla(180, 25%, 35%, 1)"). Note that this will perform a #to_hsl
112
+ # operation using the default conversion formula.
113
+ def css_hsla
114
+ to_hsl.css_hsla
115
+ end
116
+
117
+ # Converts the CMYK colour to RGB. Most colour experts strongly suggest
118
+ # that this is not a good idea (some even suggesting that it's a very bad
119
+ # idea). CMYK represents additive percentages of inks on white paper,
120
+ # whereas RGB represents mixed colour intensities on a black screen.
121
+ #
122
+ # However, the colour conversion can be done, and there are two different
123
+ # methods for the conversion that provide slightly different results.
124
+ # Adobe PDF conversions are done with the first form.
125
+ #
126
+ # # Adobe PDF Display Formula
127
+ # r = 1.0 - min(1.0, c + k)
128
+ # g = 1.0 - min(1.0, m + k)
129
+ # b = 1.0 - min(1.0, y + k)
130
+ #
131
+ # # Other
132
+ # r = 1.0 - (c * (1.0 - k) + k)
133
+ # g = 1.0 - (m * (1.0 - k) + k)
134
+ # b = 1.0 - (y * (1.0 - k) + k)
135
+ #
136
+ # If we have a CMYK colour of [33% 66% 83% 25%], the first method will
137
+ # give an approximate RGB colour of (107, 23, 0) or #6b1700. The second
138
+ # method will give an approximate RGB colour of (128, 65, 33) or #804121.
139
+ # Which is correct? Although the colours may seem to be drastically
140
+ # different in the RGB colour space, they are very similar colours,
141
+ # differing mostly in intensity. The first is a darker, slightly redder
142
+ # brown; the second is a lighter brown.
143
+ #
144
+ # Because of this subtlety, both methods are now offered for conversion.
145
+ # The Adobe method is not used by default; to enable it, pass +true+ to
146
+ # #to_rgb.
147
+ #
148
+ # Future versions of Color may offer other conversion mechanisms that
149
+ # offer greater colour fidelity, including recognition of ICC colour
150
+ # profiles.
151
+ def to_rgb(use_adobe_method = false)
152
+ if use_adobe_method
153
+ r = 1.0 - [1.0, @c + @k].min
154
+ g = 1.0 - [1.0, @m + @k].min
155
+ b = 1.0 - [1.0, @y + @k].min
156
+ else
157
+ r = 1.0 - (@c.to_f * (1.0 - @k.to_f) + @k.to_f)
158
+ g = 1.0 - (@m.to_f * (1.0 - @k.to_f) + @k.to_f)
159
+ b = 1.0 - (@y.to_f * (1.0 - @k.to_f) + @k.to_f)
160
+ end
161
+ Color::RGB.from_fraction(r, g, b)
162
+ end
163
+
164
+ # Converts the CMYK colour to a single greyscale value. There are
165
+ # undoubtedly multiple methods for this conversion, but only a minor
166
+ # variant of the Adobe conversion method will be used:
167
+ #
168
+ # g = 1.0 - min(1.0, 0.299 * c + 0.587 * m + 0.114 * y + k)
169
+ #
170
+ # This treats the CMY values similarly to YIQ (NTSC) values and then adds
171
+ # the level of black. This is a variant of the Adobe version because it
172
+ # uses the more precise YIQ (NTSC) conversion values for Y (intensity)
173
+ # rather than the approximates provided by Adobe (0.3, 0.59, and 0.11).
174
+ def to_grayscale
175
+ c = 0.299 * @c.to_f
176
+ m = 0.587 * @m.to_f
177
+ y = 0.114 * @y.to_f
178
+ g = 1.0 - [1.0, c + m + y + @k].min
179
+ Color::GrayScale.from_fraction(g)
180
+ end
181
+ alias to_greyscale to_grayscale
182
+
183
+ def to_cmyk
184
+ self
185
+ end
186
+
187
+ def inspect
188
+ "CMYK [%.2f%%, %.2f%%, %.2f%%, %.2f%%]" % [ cyan, magenta, yellow, black ]
189
+ end
190
+
191
+ # Converts to RGB then YIQ.
192
+ def to_yiq
193
+ to_rgb.to_yiq
194
+ end
195
+
196
+ # Converts to RGB then HSL.
197
+ def to_hsl
198
+ to_rgb.to_hsl
199
+ end
200
+
201
+ # Returns the cyan (C) component of the CMYK colour as a percentage value.
202
+ def cyan
203
+ @c * 100.0
204
+ end
205
+ # Returns the cyan (C) component of the CMYK colour as a value in the
206
+ # range 0.0 .. 1.0.
207
+ def c
208
+ @c
209
+ end
210
+ # Sets the cyan (C) component of the CMYK colour as a percentage value.
211
+ def cyan=(cc)
212
+ @c = Color.normalize(cc / 100.0)
213
+ end
214
+ # Sets the cyan (C) component of the CMYK colour as a value in the range
215
+ # 0.0 .. 1.0.
216
+ def c=(cc)
217
+ @c = Color.normalize(cc)
218
+ end
219
+
220
+ # Returns the magenta (M) component of the CMYK colour as a percentage
221
+ # value.
222
+ def magenta
223
+ @m * 100.0
224
+ end
225
+ # Returns the magenta (M) component of the CMYK colour as a value in the
226
+ # range 0.0 .. 1.0.
227
+ def m
228
+ @m
229
+ end
230
+ # Sets the magenta (M) component of the CMYK colour as a percentage value.
231
+ def magenta=(mm)
232
+ @m = Color.normalize(mm / 100.0)
233
+ end
234
+ # Sets the magenta (M) component of the CMYK colour as a value in the
235
+ # range 0.0 .. 1.0.
236
+ def m=(mm)
237
+ @m = Color.normalize(mm)
238
+ end
239
+
240
+ # Returns the yellow (Y) component of the CMYK colour as a percentage
241
+ # value.
242
+ def yellow
243
+ @y * 100.0
244
+ end
245
+ # Returns the yellow (Y) component of the CMYK colour as a value in the
246
+ # range 0.0 .. 1.0.
247
+ def y
248
+ @y
249
+ end
250
+ # Sets the yellow (Y) component of the CMYK colour as a percentage value.
251
+ def yellow=(yy)
252
+ @y = Color.normalize(yy / 100.0)
253
+ end
254
+ # Sets the yellow (Y) component of the CMYK colour as a value in the range
255
+ # 0.0 .. 1.0.
256
+ def y=(kk)
257
+ @y = Color.normalize(kk)
258
+ end
259
+
260
+ # Returns the black (K) component of the CMYK colour as a percentage
261
+ # value.
262
+ def black
263
+ @k * 100.0
264
+ end
265
+ # Returns the black (K) component of the CMYK colour as a value in the
266
+ # range 0.0 .. 1.0.
267
+ def k
268
+ @k
269
+ end
270
+ # Sets the black (K) component of the CMYK colour as a percentage value.
271
+ def black=(kk)
272
+ @k = Color.normalize(kk / 100.0)
273
+ end
274
+ # Sets the black (K) component of the CMYK colour as a value in the range
275
+ # 0.0 .. 1.0.
276
+ def k=(kk)
277
+ @k = Color.normalize(kk)
278
+ end
279
+ end
@@ -0,0 +1,28 @@
1
+ #--
2
+ # Color
3
+ # Colour management with Ruby
4
+ # http://rubyforge.org/projects/color
5
+ # Version 1.4.1
6
+ #
7
+ # Licensed under a MIT-style licence. See Licence.txt in the main
8
+ # distribution for full licensing information.
9
+ #
10
+ # Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
11
+ #++
12
+
13
+ require 'color'
14
+
15
+ # This namespace contains some CSS colour names.
16
+ module Color::CSS
17
+ # Returns the RGB colour for name or +nil+ if the name is not valid.
18
+ def self.[](name)
19
+ @colors[name.to_s.downcase.to_sym]
20
+ end
21
+
22
+ @colors = {}
23
+ Color::RGB.constants.each do |const|
24
+ next if const == "PDF_FORMAT_STR"
25
+ next if const == "Metallic"
26
+ @colors[const.downcase.to_sym] ||= Color::RGB.const_get(const)
27
+ end
28
+ end
@@ -0,0 +1,212 @@
1
+ #--
2
+ # Color
3
+ # Colour management with Ruby
4
+ # http://rubyforge.org/projects/color
5
+ # Version 1.4.1
6
+ #
7
+ # Licensed under a MIT-style licence. See Licence.txt in the main
8
+ # distribution for full licensing information.
9
+ #
10
+ # Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
11
+ #++
12
+
13
+ # A colour object representing shades of grey. Used primarily in PDF
14
+ # document creation.
15
+ class Color::GrayScale
16
+ # The format of a DeviceGrey colour for PDF. In color-tools 2.0 this will
17
+ # be removed from this package and added back as a modification by the
18
+ # PDF::Writer package.
19
+ PDF_FORMAT_STR = "%.3f %s"
20
+
21
+ # Creates a greyscale colour object from fractional values 0..1.
22
+ #
23
+ # Color::GreyScale.from_fraction(0.5)
24
+ def self.from_fraction(g = 0)
25
+ color = Color::GrayScale.new
26
+ color.g = g
27
+ color
28
+ end
29
+
30
+ # Creates a greyscale colour object from percentages 0..100.
31
+ #
32
+ # Color::GrayScale.from_percent(50)
33
+ def self.from_percent(g = 0)
34
+ Color::GrayScale.new(g)
35
+ end
36
+
37
+ # Creates a greyscale colour object from percentages 0..100.
38
+ #
39
+ # Color::GrayScale.new(50)
40
+ def initialize(g = 0)
41
+ @g = g / 100.0
42
+ end
43
+
44
+ # Compares the other colour to this one. The other colour will be
45
+ # converted to GreyScale before comparison, so the comparison between a
46
+ # GreyScale colour and a non-GreyScale colour will be approximate and
47
+ # based on the other colour's #to_greyscale conversion. If there is no
48
+ # #to_greyscale conversion, this will raise an exception. This will report
49
+ # that two GreyScale values are equivalent if they are within
50
+ # COLOR_TOLERANCE of each other.
51
+ def ==(other)
52
+ other = other.to_grayscale
53
+ other.kind_of?(Color::GrayScale) and
54
+ ((@g - other.g).abs <= Color::COLOR_TOLERANCE)
55
+ end
56
+
57
+ # Present the colour as a DeviceGrey fill colour string for PDF. This will
58
+ # be removed from the default package in color-tools 2.0.
59
+ def pdf_fill
60
+ PDF_FORMAT_STR % [ @g, "g" ]
61
+ end
62
+
63
+ # Present the colour as a DeviceGrey stroke colour string for PDF. This
64
+ # will be removed from the default package in color-tools 2.0.
65
+ def pdf_stroke
66
+ PDF_FORMAT_STR % [ @g, "G" ]
67
+ end
68
+
69
+ def to_255
70
+ [(@g * 255).round, 255].min
71
+ end
72
+ private :to_255
73
+
74
+ # Present the colour as an HTML/CSS colour string.
75
+ def html
76
+ gs = "%02x" % to_255
77
+ "##{gs * 3}"
78
+ end
79
+
80
+ # Present the colour as an RGB HTML/CSS colour string (e.g., "rgb(0%, 50%,
81
+ # 100%)").
82
+ def css_rgb
83
+ "rgb(%3.2f%%, %3.2f%%, %3.2f%%)" % [ gray, gray, gray ]
84
+ end
85
+
86
+ # Present the colour as an RGBA (with alpha) HTML/CSS colour string (e.g.,
87
+ # "rgb(0%, 50%, 100%, 1)").
88
+ def css_rgba
89
+ "rgba(%3.2f%%, %3.2f%%, %3.2f%%, %1.2f)" % [ gray, gray, gray, 1 ]
90
+ end
91
+
92
+ # Present the colour as an HSL HTML/CSS colour string (e.g., "hsl(180,
93
+ # 25%, 35%)"). Note that this will perform a #to_hsl operation.
94
+ def css_hsl
95
+ to_hsl.css_hsl
96
+ end
97
+
98
+ # Present the colour as an HSLA (with alpha) HTML/CSS colour string (e.g.,
99
+ # "hsla(180, 25%, 35%, 1)"). Note that this will perform a #to_hsl
100
+ # operation.
101
+ def css_hsla
102
+ to_hsl.css_hsla
103
+ end
104
+
105
+ # Convert the greyscale colour to CMYK.
106
+ def to_cmyk
107
+ k = 1.0 - @g.to_f
108
+ Color::CMYK.from_fraction(0, 0, 0, k)
109
+ end
110
+
111
+ # Convert the greyscale colour to RGB.
112
+ def to_rgb(ignored = true)
113
+ Color::RGB.from_fraction(g, g, g)
114
+ end
115
+
116
+ # Reflexive conversion.
117
+ def to_grayscale
118
+ self
119
+ end
120
+ alias to_greyscale to_grayscale
121
+
122
+ # Lightens the greyscale colour by the stated percent.
123
+ def lighten_by(percent)
124
+ g = [@g + (@g * (percent / 100.0)), 1.0].min
125
+ Color::GrayScale.from_fraction(g)
126
+ end
127
+
128
+ # Darken the greyscale colour by the stated percent.
129
+ def darken_by(percent)
130
+ g = [@g - (@g * (percent / 100.0)), 0.0].max
131
+ Color::GrayScale.from_fraction(g)
132
+ end
133
+
134
+ # Returns the YIQ (NTSC) colour encoding of the greyscale value. This is
135
+ # an approximation, as the values for I and Q are calculated by treating
136
+ # the greyscale value as an RGB value. The Y (intensity or brightness)
137
+ # value is the same as the greyscale value.
138
+ def to_yiq
139
+ y = @g
140
+ i = (@g * 0.596) + (@g * -0.275) + (@g * -0.321)
141
+ q = (@g * 0.212) + (@g * -0.523) + (@g * 0.311)
142
+ Color::YIQ.from_fraction(y, i, q)
143
+ end
144
+
145
+ # Returns the HSL colour encoding of the greyscale value.
146
+ def to_hsl
147
+ Color::HSL.from_fraction(0, 0, @g)
148
+ end
149
+
150
+ # Returns the brightness value for this greyscale value; this is the
151
+ # greyscale value itself.
152
+ def brightness
153
+ @g
154
+ end
155
+
156
+ # Returns the grayscale value as a percentage of white (100% gray is
157
+ # white).
158
+ def gray
159
+ @g * 100.0
160
+ end
161
+ alias grey gray
162
+ # Returns the grayscale value as a fractional value of white in the range
163
+ # 0.0 .. 1.0.
164
+ def g
165
+ @g
166
+ end
167
+ # Sets the grayscale value as a percentage of white.
168
+ def gray=(gg)
169
+ @g = Color.normalize(gg / 100.0)
170
+ end
171
+ alias grey= gray= ;
172
+ # Returns the grayscale value as a fractional value of white in the range
173
+ # 0.0 .. 1.0.
174
+ def g=(gg)
175
+ @g = Color.normalize(gg)
176
+ end
177
+
178
+ # Adds another colour to the current colour. The other colour will be
179
+ # converted to grayscale before addition. This conversion depends upon a
180
+ # #to_grayscale method on the other colour.
181
+ #
182
+ # The addition is done using the grayscale accessor methods to ensure a
183
+ # valid colour in the result.
184
+ def +(other)
185
+ other = other.to_grayscale
186
+ ng = self.dup
187
+ ng.g += other.g
188
+ ng
189
+ end
190
+
191
+ # Subtracts another colour to the current colour. The other colour will be
192
+ # converted to grayscale before subtraction. This conversion depends upon
193
+ # a #to_grayscale method on the other colour.
194
+ #
195
+ # The subtraction is done using the grayscale accessor methods to ensure a
196
+ # valid colour in the result.
197
+ def -(other)
198
+ other = other.to_grayscale
199
+ ng = self.dup
200
+ ng.g -= other.g
201
+ ng
202
+ end
203
+
204
+ def inspect
205
+ "Gray [%.2f%%]" % [ gray ]
206
+ end
207
+ end
208
+
209
+ module Color
210
+ # A synonym for Color::GrayScale.
211
+ GreyScale = GrayScale
212
+ end