rouge-gtk_theme_loader 0.2.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a9706917b81b7062ff0c8179a0f311dd2cc001d04e8b107e6488e6f3e6da770
4
- data.tar.gz: 7f4bd896660cdb58f133f81bcbee6980a2bc3ec597b5f52b57e55fe892ac18db
3
+ metadata.gz: d67d1e8cb8dc82d230472e916c32c59a666917015a7b5e147f7928c2596bbf58
4
+ data.tar.gz: e6a2816937838310a3f778e33ec7a021ec78f1e737e773c2079d24a290bde44e
5
5
  SHA512:
6
- metadata.gz: c939865348ac7264c678fba0c24430e836892b0b8026ef5b8277d9034de4bc099d9819eabbfc656d8ae50e2f8091c002e1b613d74241bfa7075f336ad6528f10
7
- data.tar.gz: 4030d0fa9c4fed91de65f7e19f397885cb6921a1b1baa1592420b696cd55383bee6fc4ffaf1dad00bc3f26bcd799a23d03bf5b3f6254ce81015607cd3c32aab1
6
+ metadata.gz: aa915a5dabf80736613975c3ea865431ebc5e7a264fc968b129646e8dbac3de49e210cdd55ffeb3486dc39386b46f47ba245b0c4b78e00807c2f025bf7115808
7
+ data.tar.gz: 56422be1692e264b616becd2cee3b3cd4e263af070dea18fdffeb7a676353b30cf7d8c776435ddf8a15989e2aac1159e563b98da6abdfb1e961aa294e1340dea
data/README.md CHANGED
@@ -10,9 +10,19 @@ Install the gem and add to the application's Gemfile by executing:
10
10
 
11
11
  ## Usage
12
12
 
13
- Require Rouge first. Then require 'rouge/gtk_theme_loader' and it will attempt to load any installed
14
- GtkSourceView themes into Rouge. If you want to install your own custom GtkSourceView
15
- themes, you can install them in ~/.config/rouge/themes/
13
+ Require Rouge first. Then require 'rouge/gtk_theme_loader' and it will attempt to load
14
+ any installed GtkSourceView themes into Rouge. If you want to install your own custom
15
+ GtkSourceView themes, you can install them in
16
+ `~/.local/share/gtksourceview-4/styles`, or if you want them to only
17
+ apply to Rouge, you can drop them in `~/.local/share/rouge/styles` (NOTE: This
18
+ path has changed to match XDG specs better, and to match GtkSourceView
19
+ naming convention better). It will also check /usr/share/gtksourceview-4
20
+ as well as gtksourceview-2.0 and gtksourceview-3.0 directories.
21
+
22
+ For a source of GtkSourceView style files that have been mostly
23
+ tested with this gem, check out:
24
+
25
+ <https://github.com/trusktr/gedit-color-schemes/tree/master>
16
26
 
17
27
  ## Development
18
28
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  class GtkThemeLoader
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
@@ -16,10 +16,14 @@ module Rouge
16
16
  "/usr/share/gtksourceview-2.0/styles/*.xml",
17
17
  "/usr/share/gtksourceview-3.0/styles/*.xml",
18
18
  "/usr/share/gtksourceview-4/styles/*.xml",
19
- "~/.config/rouge/themes/*.xml"
19
+ "~/.local/share/gtksourceview-2.0/styles/*.xml",
20
+ "~/.local/share/gtksourceview-3.0/styles/*.xml",
21
+ "~/.local/share/gtksourceview-4/styles/*.xml",
22
+ "~/.local/share/rouge/styles/*.xml"
20
23
  ]
21
24
 
22
- # Mapping of GTK source view mappings.
25
+ # GTK source view mappings to Rouge token mappings
26
+ # This is incomplete.
23
27
  GTKMAPPING = {
24
28
  "def:string" => Literal::String,
25
29
  "def:constant" => Literal,
@@ -32,6 +36,16 @@ module Rouge
32
36
  "def:identifier" => Name::Builtin,
33
37
  "def:emphasis" => Generic::Emph,
34
38
  "def:preprocessor" => Name::Builtin,
39
+ "def:builtin" => Name::Builtin,
40
+ "def:instance-variable" => Name::Variable::Instance,
41
+ "def:operator" => Operator,
42
+ "def:boolean" => Keyword::Pseudo,
43
+
44
+ # FIXME: Use theme specific ones as fallbacks only.
45
+ "ruby:global-variable" => Name::Variable::Global,
46
+ "ruby:instance-variable" => Name::Variable::Instance,
47
+ "ruby:constant" => Name::Constant,
48
+ "ruby:builtin" => Name::Builtin,
35
49
  }
36
50
 
37
51
  def self.load!
@@ -63,7 +77,7 @@ module Rouge
63
77
 
64
78
  def self.load(theme)
65
79
  xml = Nokogiri.XML(File.read(theme))
66
- theme = Class.new(ReTheme)
80
+ theme = Class.new(GtkTheme)
67
81
  name = xml.xpath("/style-scheme").attr("id").value
68
82
  theme.name(name)
69
83
 
@@ -76,13 +90,13 @@ module Rouge
76
90
  if @text
77
91
 
78
92
  theme.style(Text,
79
- :fg => @text.attr("foreground").to_sym,
80
- :bg => @text.attr("background").to_sym
93
+ :fg => @text&.attr("foreground")&.to_sym,
94
+ :bg => @text&.attr("background")&.to_sym
81
95
  )
82
96
  else
83
97
  bgp = xml.xpath("//style[@name='background-pattern']")
84
98
  if bgp
85
- bg = bgp.attr("background").value
99
+ bg = bgp&.attr("background")&.value
86
100
  end
87
101
  bg ||= "#000000"
88
102
  if bg[0] == ?#
data/screenshots/1.png ADDED
Binary file
data/screenshots/2.png ADDED
Binary file
data/screenshots/3.png ADDED
Binary file
data/screenshots/4.png ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge-gtk_theme_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vidar Hokstad
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-05 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rouge
@@ -36,6 +36,10 @@ files:
36
36
  - Rakefile
37
37
  - lib/rouge/gtk_theme_loader.rb
38
38
  - lib/rouge/gtk_theme_loader/version.rb
39
+ - screenshots/1.png
40
+ - screenshots/2.png
41
+ - screenshots/3.png
42
+ - screenshots/4.png
39
43
  - sig/rouge/gtk_theme_loader.rbs
40
44
  homepage: https://github.com/vidarh/rouge-gtk_theme_loader
41
45
  licenses: