palettetown 0.1.0 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1fde914a1e688407fb65cbc479596395b90984c
4
- data.tar.gz: b3cd59e0b9ef02fe2751184a61a961d0a92ad119
3
+ metadata.gz: 189f07bed93609b4c278e84c915f5718065816a6
4
+ data.tar.gz: 74889a840024376f437a5c8ee0d24c8a2ca49824
5
5
  SHA512:
6
- metadata.gz: 3321f8dab21c377c9e08e1c484d76de94f64b7b635e889ddbc76ad3c7669002012e3364d1ba836d51f61652c669edfb5d5d57281512b5969395c0d8403eb99b2
7
- data.tar.gz: 262a4a0b7a826ea7f27c9038eadddefd95c18d755242d201fbdef7f2b6ac2f68cd9babbfb2bdbd9c4a7ec5cbd56c77238002430200693c358fbe37fb2cc3810f
6
+ metadata.gz: 4c439643efecb2331ba079e9b6bc793338dec5281367e620a9b783a4b76fc66d81e9642e97289a0479a783dd350832f16877ccf44b34f12299bcafd1791a7391
7
+ data.tar.gz: fc4b6c7ecc3aed56018944b37da7ac47f9878892518051ff3bf0e70b8dcfb3ce423683ec840f37861ffe5567f93588082babd3a7e2dbf08c0b3f8749ff5871e4
data/README.md CHANGED
@@ -1,4 +1,40 @@
1
- palettetown
2
- ===========
3
-
1
+ # Palette Town
4
2
  A ruby tool for generating vim color schemes.
3
+
4
+ ## Palette Files
5
+ Palette files are just normal Ruby files, so you can use Ruby code however
6
+ you like. No, really; that's why I made it when there was already
7
+ [joshuaclayton/palette](https://github.com/joshuaclayton/palette).
8
+
9
+ To demonstrate this, here's an example file. Please. for the love of God,
10
+ DO NOT USE THESE COLORS. Seriously, they're hideous.
11
+ ```ruby
12
+ name 'Kawaii'
13
+ author 'Desu Yo'
14
+ description 'the most super kawaii theme ever'
15
+
16
+ main_bg = "00FF00"
17
+
18
+ hi :Normal, "0000FF", main_bg
19
+ hi :LineNr, darker(hi[:Normal][:fg], 10)
20
+ hi :Boolean, :bg => main_bg
21
+ ```
22
+
23
+ ### Helpers
24
+ * `lighter(color, amount)` - Increases luminosity of a color by `amount`%.
25
+ * `darker(color, amount)` - Decreases luminosity of a color by `amount`%.
26
+ * `saturate(color, amount)` - Increases saturation of a color by `amount`%.
27
+ * `desaturate(color, amount)` - Decreases saturation of a color by `amount`%.
28
+ * `spin(color, amount)` - shifts the hue by `amount` degrees.
29
+
30
+ ## Building a palette file
31
+ Once you've written a palette file, you build it into a proper vim theme with
32
+ the following command:
33
+
34
+ $ palettetown build file.rb -o file.vim
35
+
36
+ ## Planned Features
37
+ * Styles (italic, bold, underline)
38
+ * Automatic console color picking
39
+ * Support for entering the hex values of your 16-color set and using
40
+ those for matching.
@@ -1,7 +1,13 @@
1
1
  module PaletteTown
2
2
  class Rule
3
3
  def [] key
4
- @keys[key]
4
+ if key == :bg
5
+ @keys[:guibg]
6
+ elsif key == :fg
7
+ @keys[:guifg]
8
+ else
9
+ @keys[key]
10
+ end
5
11
  end
6
12
  def each &block
7
13
  @keys.each(&block)
@@ -10,12 +16,12 @@ module PaletteTown
10
16
  # TODO: Need to find nearest console color
11
17
  # TODO: Create PaletteTown::TermColor class
12
18
  @keys = {}
13
- @keys[:guifg] = PaletteTown::Color.new(rule[:fg])
14
- @keys[:ctermfg] = rule[:fg_term]
15
- @keys[:guibg] = PaletteTown::Color.new(rule[:bg])
16
- @keys[:ctermbg] = rule[:bg_term]
17
- @keys[:gui] = rule[:style]
18
- @keys[:cterm] = rule[:style_term]
19
+ @keys[:guifg] = PaletteTown::Color.new(rule[:fg]) if rule[:fg]
20
+ @keys[:ctermfg] = rule[:fg_term] if rule[:fg_term]
21
+ @keys[:guibg] = PaletteTown::Color.new(rule[:bg]) if rule[:bg]
22
+ @keys[:ctermbg] = rule[:bg_term] if rule[:bg_term]
23
+ @keys[:gui] = rule[:style] if rule[:style]
24
+ @keys[:cterm] = rule[:style_term] if rule[:style_term]
19
25
  end
20
26
  end
21
27
  end
@@ -46,9 +46,20 @@ module PaletteTown
46
46
  color.hue += amount / 360.0
47
47
  color
48
48
  end
49
- def hi rule, *options
49
+ def hi *options
50
+ return @rules if options.length == 0
51
+
50
52
  @rules ||= {}
51
- @rules[rule] = PaletteTown::Rule.new(*options)
53
+ rule = options.shift
54
+ if options[0].is_a? Hash
55
+ options = options[0]
56
+ else
57
+ options = {
58
+ :fg => options[0],
59
+ :bg => options[1]
60
+ }
61
+ end
62
+ @rules[rule] = PaletteTown::Rule.new(options)
52
63
  end
53
64
  def to_s
54
65
  out = <<-EOF
@@ -1,3 +1,3 @@
1
1
  module Palettetown
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: palettetown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Lejeck