rabbit-theme-sumi 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3dce512e5941b71b0195bd1eeb65a582c12273ab61a816378e478ddb88d82ff0
4
+ data.tar.gz: a78e8ee38620dfbb7b0c718535b4449ce93b7286968565a6cb4afea997e33c6e
5
+ SHA512:
6
+ metadata.gz: 3568c40721e72ec5d07ea4a915798322d36410c78d710d185abab445990dcb6fea912bc9736501df7e7362d1c74a432f776be2037d971e9df25daf58263ea5cc
7
+ data.tar.gz: d7ca57cd8fe55987132d4116eeb6f3ca2029baf5c63a28d123bb04ae94522a3ba5a616a6f0c5527aa84f9b331c7c0a5d4525c8697f12786b42dfa562291161a1
data/LICENSE ADDED
@@ -0,0 +1,339 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # rabbit-theme-sumi
2
+
3
+ Sumi-ink dark theme for Rabbit: grayscale palette, text item marks, no frames.
4
+
5
+ Everything except syntax highlighting is built from hueless shades of gray.
6
+ Emphasis is expressed with lightness, weight and italics instead of hue. Item
7
+ marks are drawn as U+25AA (BLACK SMALL SQUARE) characters instead of images or
8
+ shapes, and are the same at every level. Headline underlines and the frames
9
+ around block quotes and code blocks are removed; those blocks are shown as
10
+ rounded panels one step lighter than the background.
11
+
12
+ ## For author
13
+
14
+ ### Show
15
+
16
+ rake
17
+
18
+ ### Publish
19
+
20
+ rake publish
21
+
22
+ ## For users
23
+
24
+ ### Install
25
+
26
+ gem install rabbit-theme-sumi
27
+
28
+ ### Show
29
+
30
+ rabbit -t rabbit-theme-sumi rabbit-theme-benchmark-en.gem
31
+
32
+ ## Customize
33
+
34
+ Put `theme.rb` in your slide directory, set variables you want to
35
+ override, then include this theme:
36
+
37
+ ```ruby
38
+ # theme.rb in your slide directory
39
+ @image_slide_number_image = "my-rabbit.png" # image for slide progress
40
+ @image_timer_image = "my-turtle.png" # image for elapsed time
41
+ include_theme("rabbit-theme-sumi")
42
+ ```
43
+
44
+ Images are searched in `data/` if it exists, otherwise in the slide
45
+ directory. Use `--theme .` (in `.rabbit` for example) to apply it. All
46
+ `@base_*` (palette) and `@sumi_*` variables can be overridden the same
47
+ way.
48
+
49
+ ## License
50
+
51
+ GPLv2 or later. See the `LICENSE` file for details.
52
+
53
+ The slide number drawing in `theme.rb` is based on Rabbit's
54
+ image-slide-number theme, Copyright (C) Sutou Kouhei <kou@cozmixng.org>,
55
+ and has been modified.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "rabbit/task/theme"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ Rabbit::Task::Theme.new do |task|
6
+ # LICENSE is not included by default
7
+ task.spec.files += ["LICENSE"]
8
+ # task.spec.files += Dir.glob("doc/**/*.*")
9
+ # task.spec.files -= Dir.glob("private/**/*.*")
10
+ # task.spec.add_runtime_dependency("DEPENDED THEME")
11
+ end
data/config.yaml ADDED
@@ -0,0 +1,14 @@
1
+ ---
2
+ id: sumi
3
+ tags:
4
+ - dark
5
+ version: 1.0.0
6
+ licenses:
7
+ - GPL-2.0-or-later
8
+ author:
9
+ markup_language: :markdown
10
+ name: Shugo Maeda
11
+ email: shugo@ruby-lang.org
12
+ rubygems_user: shugo
13
+ slideshare_user:
14
+ speaker_deck_user:
Binary file
Binary file
data/theme.rb ADDED
@@ -0,0 +1,464 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2026 Shugo Maeda <shugo@ruby-lang.org>
4
+ #
5
+ # This program is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 2 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License along
16
+ # with this program; if not, write to the Free Software Foundation, Inc.,
17
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
+ #
19
+ # The slide number drawing in this file is based on Rabbit's
20
+ # image-slide-number theme, Copyright (C) Sutou Kouhei
21
+ # <kou@cozmixng.org>, and has been modified as noted there.
22
+ #
23
+ # sumi: a sumi-ink (dark background) theme.
24
+ #
25
+ # Item marks are drawn as U+25AA (BLACK SMALL SQUARE) characters in
26
+ # light gray instead of images or shapes.
27
+
28
+ #--------------------------------------
29
+ # Base colors (monotone)
30
+ #--------------------------------------
31
+ # Only hueless shades of gray are used. Emphasis is expressed with
32
+ # lightness, weight and italics.
33
+ #
34
+ # All variables below are set with ||=, so they can be overridden by
35
+ # assigning them before include_theme("rabbit-theme-sumi") in the
36
+ # slide's theme.rb.
37
+ @base_background ||= "#262626"
38
+ @base_panel_color ||= "#3a3a3a"
39
+ @base_panel_head_color ||= "#474747"
40
+ @base_frame_color ||= "#595959"
41
+ @base_dim_foreground ||= "#8c8c8c"
42
+ @base_sub_foreground ||= "#b3b3b3"
43
+ @base_foreground ||= "#e6e6e6"
44
+ @base_bright_foreground ||= "#ffffff"
45
+
46
+ @default_foreground ||= @base_foreground
47
+ @default_background ||= @base_background
48
+ @default_shadow_color ||= "#0009"
49
+
50
+ @default_emphasis_color ||= @base_bright_foreground
51
+ @default_emphasis_level2_color ||= @base_bright_foreground
52
+ @default_link_color ||= @base_bright_foreground
53
+
54
+ set_graffiti_color("#{@base_sub_foreground}99")
55
+ set_progress_foreground(@base_dim_foreground)
56
+ set_progress_background(@base_panel_color)
57
+
58
+ #--------------------------------------
59
+ # Item marks (drawn as text)
60
+ #--------------------------------------
61
+ # Marks are drawn as characters, not shapes or images, so specify the
62
+ # character itself instead of a mark type. All levels use the same
63
+ # light gray square.
64
+ @sumi_item_mark_text ||= "▪" # ▪: BLACK SMALL SQUARE (U+25AA)
65
+ @sumi_item_mark_color ||= @base_sub_foreground
66
+
67
+ @default_item1_mark_color ||= @sumi_item_mark_color
68
+ @default_item2_mark_color ||= @sumi_item_mark_color
69
+ @default_item3_mark_color ||= @sumi_item_mark_color
70
+ @default_enum_item1_mark_color ||= @sumi_item_mark_color
71
+ @default_enum_item2_mark_color ||= @sumi_item_mark_color
72
+ @default_description_item1_mark_color ||= @sumi_item_mark_color
73
+ @default_block_quote_item1_mark_color ||= @sumi_item_mark_color
74
+
75
+ #--------------------------------------
76
+ # Flags of the slide number (the rabbit and the turtle)
77
+ #--------------------------------------
78
+ # The standard image-slide-number theme hardcodes the flag pole and
79
+ # frame colors to black (setup_flag_params in Rabbit's
80
+ # renderer/kernel.rb does pole_color ||= "black"), and no theme
81
+ # variable changes them. Disable it; the same drawing is done below.
82
+ @image_slide_number_uninstall = true
83
+
84
+ # The image, its size and the number color use the same variable names
85
+ # as the standard image-slide-number theme.
86
+ @image_slide_number_image ||= "mini-usa-taro.png"
87
+ @image_slide_number_space_ratio ||= 1.0 / 12.0
88
+ @image_slide_number_text_color ||= @base_foreground
89
+ # The start and goal flags share one color; only the pole is lighter.
90
+ @sumi_slide_number_flag_color ||= @base_frame_color
91
+ @sumi_slide_number_pole_color ||= @base_dim_foreground
92
+
93
+ #--------------------------------------
94
+ # Description list
95
+ #--------------------------------------
96
+ @description_term_line_color ||= @base_frame_color
97
+
98
+ #--------------------------------------
99
+ # Preformatted text and block quote
100
+ #--------------------------------------
101
+ # No frame is drawn, so show them as rounded panels one step lighter
102
+ # than the background, with generous padding so that they read as
103
+ # panels.
104
+ @sumi_panel_radius ||= screen_y(1.5)
105
+ @preformatted_fill_color ||= @base_panel_color
106
+ @preformatted_padding_left ||= screen_x(7)
107
+ @preformatted_padding_right ||= screen_x(7)
108
+ @preformatted_padding_top ||= screen_y(3)
109
+ @preformatted_padding_bottom ||= screen_y(3)
110
+
111
+ @block_quote_fill_color ||= @base_panel_color
112
+ @block_quote_title_color ||= @base_dim_foreground
113
+ @block_quote_padding_left ||= screen_x(7)
114
+ @block_quote_padding_right ||= screen_x(7)
115
+ @block_quote_padding_top ||= screen_y(3)
116
+ @block_quote_padding_bottom ||= screen_y(3)
117
+
118
+ #--------------------------------------
119
+ # Table and image
120
+ #--------------------------------------
121
+ @table_frame_color ||= @base_frame_color
122
+ @table_fill_color ||= @base_panel_color
123
+ @table_head_frame_color ||= @base_frame_color
124
+ @table_body_frame_color ||= @base_frame_color
125
+ @table_head_fill_color ||= @base_panel_head_color
126
+ @table_body_fill_color ||= @base_panel_color
127
+ @table_caption_color ||= @base_foreground
128
+
129
+ @image_caption_color ||= @base_foreground
130
+ @image_frame_color ||= @base_frame_color
131
+ @image_frame_shadow_color ||= "#000000"
132
+
133
+ #--------------------------------------
134
+ # Syntax highlighting
135
+ #--------------------------------------
136
+ # This is the only part that is not monotone. Follow Catppuccin Mocha:
137
+ # the palette is from https://github.com/catppuccin/palette and the
138
+ # assignment follows the "Syntax Colors" table of
139
+ # https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md
140
+ # The keys cover both CodeRay's token names (RD) and Rouge's (Markdown).
141
+ @syntax_highlighting_foreground ||= @base_foreground
142
+ @syntax_highlighting_fill_color ||= @base_panel_color
143
+ @syntax_highlighting_padding_left ||= screen_x(7)
144
+ @syntax_highlighting_padding_right ||= screen_x(7)
145
+ @syntax_highlighting_padding_top ||= screen_y(3)
146
+ @syntax_highlighting_padding_bottom ||= screen_y(3)
147
+
148
+ sumi_catppuccin_mocha = {
149
+ :fg => @syntax_highlighting_foreground,
150
+ :mauve => "#cba6f7",
151
+ :green => "#a6e3a1",
152
+ :red => "#f38ba8",
153
+ :pink => "#f5c2e7",
154
+ :peach => "#fab387",
155
+ :sky => "#89dceb",
156
+ :blue => "#89b4fa",
157
+ :maroon => "#eba0ac",
158
+ :yellow => "#f9e2af",
159
+ :teal => "#94e2d5",
160
+ :overlay2 => "#9399b2",
161
+ }
162
+ @syntax_highlighting_scheme ||= {
163
+ # Comments: Overlay 2
164
+ :comment => {:color => sumi_catppuccin_mocha[:overlay2], :style => "italic"},
165
+ :comment_delimiter => {:color => sumi_catppuccin_mocha[:overlay2], :style => "italic"},
166
+ # Keyword: Mauve
167
+ :reserved => {:color => sumi_catppuccin_mocha[:mauve]},
168
+ :keyword => {:color => sumi_catppuccin_mocha[:mauve]},
169
+ :include => {:color => sumi_catppuccin_mocha[:mauve]},
170
+ :preprocessor => {:color => sumi_catppuccin_mocha[:mauve]},
171
+ :directive => {:color => sumi_catppuccin_mocha[:mauve]},
172
+ # Strings: Green
173
+ :string => {:color => sumi_catppuccin_mocha[:green]},
174
+ :content => {:color => sumi_catppuccin_mocha[:green]},
175
+ :delimiter => {:color => sumi_catppuccin_mocha[:green]},
176
+ # Symbols, Atoms: Red
177
+ :symbol => {:color => sumi_catppuccin_mocha[:red]},
178
+ # Escape Sequences, Regex: Pink
179
+ :escape => {:color => sumi_catppuccin_mocha[:pink]},
180
+ :char => {:color => sumi_catppuccin_mocha[:pink]},
181
+ :regexp => {:color => sumi_catppuccin_mocha[:pink]},
182
+ :regex => {:color => sumi_catppuccin_mocha[:pink]},
183
+ # Constants, Numbers: Peach
184
+ :constant => {:color => sumi_catppuccin_mocha[:peach]},
185
+ :pre_constant => {:color => sumi_catppuccin_mocha[:peach]},
186
+ :integer => {:color => sumi_catppuccin_mocha[:peach]},
187
+ :float => {:color => sumi_catppuccin_mocha[:peach]},
188
+ :number => {:color => sumi_catppuccin_mocha[:peach]},
189
+ # Operators: Sky
190
+ :operator => {:color => sumi_catppuccin_mocha[:sky]},
191
+ # Braces, Delimiters: Overlay 2
192
+ :punctuation => {:color => sumi_catppuccin_mocha[:overlay2]},
193
+ # Methods, Functions: Blue
194
+ :method => {:color => sumi_catppuccin_mocha[:blue]},
195
+ :function => {:color => sumi_catppuccin_mocha[:blue]},
196
+ # Builtins: Red
197
+ :builtin => {:color => sumi_catppuccin_mocha[:red]},
198
+ # Classes, Types: Yellow
199
+ :class => {:color => sumi_catppuccin_mocha[:yellow]},
200
+ :module => {:color => sumi_catppuccin_mocha[:yellow]},
201
+ :pre_type => {:color => sumi_catppuccin_mocha[:yellow]},
202
+ :predefined_type => {:color => sumi_catppuccin_mocha[:yellow]},
203
+ :exception => {:color => sumi_catppuccin_mocha[:yellow]},
204
+ :decorator => {:color => sumi_catppuccin_mocha[:yellow]},
205
+ # Variables: Text (no color); Property: Blue; Attributes: Yellow
206
+ :variable => {:color => sumi_catppuccin_mocha[:fg]},
207
+ :instance_variable => {:color => sumi_catppuccin_mocha[:fg]},
208
+ :class_variable => {:color => sumi_catppuccin_mocha[:fg]},
209
+ :global_variable => {:color => sumi_catppuccin_mocha[:fg]},
210
+ :property => {:color => sumi_catppuccin_mocha[:blue]},
211
+ :attribute => {:color => sumi_catppuccin_mocha[:yellow]},
212
+ # Tags (e.g. HTML): Mauve like keywords
213
+ :tag => {:color => sumi_catppuccin_mocha[:mauve]},
214
+ # diff
215
+ :head => {:color => sumi_catppuccin_mocha[:blue]},
216
+ :change => {:color => sumi_catppuccin_mocha[:peach]},
217
+ :delete => {:color => sumi_catppuccin_mocha[:red]},
218
+ :insert => {:color => sumi_catppuccin_mocha[:green]},
219
+ }
220
+
221
+ include_theme("default")
222
+
223
+ #--------------------------------------
224
+ # Remove the headline underline; draw quotes and code as rounded panels
225
+ #--------------------------------------
226
+ match(Slide, HeadLine) do |heads|
227
+ heads.delete_post_draw_proc_by_name("head-line")
228
+ end
229
+
230
+ # Replace the framed drawing procedure registered by the standard theme
231
+ # with one of the same name that only fills a rounded rectangle.
232
+ def setup_sumi_panel(blocks, name, color)
233
+ blocks.delete_pre_draw_proc_by_name(name)
234
+ blocks.add_pre_draw_proc(name) do |block, canvas, x, y, w, h, simulation|
235
+ unless simulation
236
+ canvas.draw_rounded_rectangle(true,
237
+ block.x,
238
+ block.y + block.centering_adjusted_height,
239
+ block.width,
240
+ block.height,
241
+ @sumi_panel_radius,
242
+ color)
243
+ end
244
+ [x, y, w, h]
245
+ end
246
+ end
247
+
248
+ match("**", PreformattedBlock) do |blocks|
249
+ setup_sumi_panel(blocks, "preformatted-block", @preformatted_fill_color)
250
+ end
251
+
252
+ match("**", SyntaxHighlightingBlock) do |blocks|
253
+ setup_sumi_panel(blocks, "syntax-highlighting-block",
254
+ @syntax_highlighting_fill_color)
255
+ end
256
+
257
+ match("**", BlockQuote) do |blocks|
258
+ setup_sumi_panel(blocks, "block-quote", @block_quote_fill_color)
259
+ end
260
+
261
+ #--------------------------------------
262
+ # Draw the slide number (the rabbit and the turtle)
263
+ #--------------------------------------
264
+ # Based on Rabbit's image-slide-number theme (Copyright (C) Sutou Kouhei
265
+ # <kou@cozmixng.org>, GPLv2+) with the following changes:
266
+ # * The flag pole and frame colors (pole_color, flag_frame_color) are
267
+ # configurable.
268
+ # * The flag frame width is 0 so that the number is centered on the
269
+ # flag.
270
+ # * The start and goal flags share one color, and the branch that
271
+ # uses flag images is removed.
272
+ add_image_path("rabbit-images")
273
+
274
+ sumi_slide_number_proc_name = "sumi-slide-number"
275
+
276
+ match(Slide) do |slides|
277
+ slides.delete_pre_draw_proc_by_name(sumi_slide_number_proc_name)
278
+ slides.delete_post_draw_proc_by_name(sumi_slide_number_proc_name)
279
+
280
+ # Like the standard theme, don't draw the slide number when printing.
281
+ break if print?
282
+
283
+ loader = ImageLoader.new(find_file(@image_slide_number_image))
284
+ draw_parameters = {
285
+ :reflect => {:ratio => 0.5, :alpha => 0.5},
286
+ :draw_scaled_pixbuf => false,
287
+ }
288
+
289
+ if canvas.n_slides < 2
290
+ max_text_length = 1
291
+ else
292
+ max_text_length = Math.log10(canvas.n_slides - 1).truncate + 1
293
+ end
294
+ text_attributes = {
295
+ "size" => @xx_small_font_size / max_text_length,
296
+ "font_family" => @font_family,
297
+ "color" => @image_slide_number_text_color,
298
+ "weight" => "heavy",
299
+ }
300
+
301
+ # The frame has the same color as the flag so that the flag looks
302
+ # solid; only the pole is lighter. The frame width is 0 so that the
303
+ # number is centered on the flag excluding the pole. (Rabbit centers
304
+ # the text in a box of "flag width - frame width * 2", so a frame
305
+ # shifts the text to the left. The frame has the same color as the
306
+ # flag, so the width doesn't change how it looks.)
307
+ make_flag_props = lambda do |text|
308
+ {
309
+ "flag_type" => "rectangle",
310
+ "text" => text,
311
+ "text_attributes" => text_attributes,
312
+ "flag_color" => @sumi_slide_number_flag_color,
313
+ "flag_frame_color" => @sumi_slide_number_flag_color,
314
+ "flag_frame_width" => 0,
315
+ "pole_color" => @sumi_slide_number_pole_color,
316
+ }
317
+ end
318
+
319
+ flag_width = 0
320
+
321
+ draw = lambda do |slide, canvas, x, y, w, h, simulation|
322
+ image_height = canvas.height * @image_slide_number_space_ratio
323
+ loader.resize(nil, image_height)
324
+
325
+ if simulation
326
+ props = make_flag_props.call("%#{max_text_length}d" % canvas.n_slides)
327
+ flag_width, _ = canvas.flag_size(image_height, props)
328
+ else
329
+ margin_left = slide.margin_left
330
+ margin_right = slide.margin_right
331
+ margin_bottom = slide.margin_bottom
332
+ base_x = margin_left
333
+ base_y = canvas.height - loader.height - margin_bottom
334
+ max_width = canvas.width - margin_right - base_x - loader.width
335
+ goal_base_x = canvas.width - margin_right - flag_width
336
+
337
+ props = make_flag_props.call("%0#{max_text_length}d" % slide.index)
338
+ canvas.draw_flag(base_x, base_y, loader.height, props)
339
+
340
+ props = make_flag_props.call((canvas.n_slides - 1).to_s)
341
+ canvas.draw_flag(goal_base_x, base_y, loader.height, props)
342
+
343
+ if canvas.n_slides < 3
344
+ ratio = 1
345
+ else
346
+ ratio = (slide.index - 1.0) / (canvas.n_slides - 2.0)
347
+ ratio = 0 if ratio < 0
348
+ ratio = 1 if ratio > 1
349
+ end
350
+ loader.draw(canvas, base_x + max_width * ratio, base_y, draw_parameters)
351
+ end
352
+ [x, y, w, h]
353
+ end
354
+
355
+ if slides[0].is_a?(PopplerSlide)
356
+ slides.add_post_draw_proc(sumi_slide_number_proc_name, &draw)
357
+ else
358
+ slides.add_pre_draw_proc(sumi_slide_number_proc_name, &draw)
359
+ end
360
+ end
361
+
362
+ #--------------------------------------
363
+ # Draw item marks as text
364
+ #--------------------------------------
365
+ # default-item-mark draws rectangles or circles. Re-register the drawing
366
+ # procedures of the same names to draw characters instead.
367
+ def setup_sumi_text_item_mark(items, name, mark, width, height,
368
+ space_ratio, color)
369
+ setup_default_item_mark(items, name, width, height, space_ratio, color) do
370
+ |item, canvas, x, y, w, h, mark_color, options|
371
+ first_element = item.empty? ? nil : item.first
372
+ if first_element.respond_to?(:text_props)
373
+ text_props = first_element.text_props
374
+ else
375
+ text_props = {}
376
+ end
377
+ props = text_props.merge({
378
+ "font-family" => @font_family,
379
+ "weight" => "bold",
380
+ "foreground" =>
381
+ canvas.make_color(mark_color).to_gdk_format,
382
+ })
383
+ layout = make_layout(span(props, mark))
384
+ text_width, text_height = layout.pixel_size
385
+ canvas.draw_layout(layout,
386
+ x - text_width / 2.0,
387
+ y - text_height / 3.0)
388
+ end
389
+ end
390
+
391
+ slide_body = [Slide, Body]
392
+ item_list_item = [ItemList, ItemListItem]
393
+ enum_list_item = [EnumList, EnumListItem]
394
+ desc_list_content = [DescriptionList, DescriptionListItem, DescriptionContent]
395
+ block_quote = [BlockQuote]
396
+
397
+ match(*(slide_body + (item_list_item * 1))) do |items|
398
+ setup_sumi_text_item_mark(items, "item1",
399
+ @sumi_item_mark_text,
400
+ 2, 2, (3 / 4.0),
401
+ @default_item1_mark_color)
402
+ end
403
+
404
+ match(*(slide_body + (item_list_item * 2))) do |items|
405
+ setup_sumi_text_item_mark(items, "item2",
406
+ @sumi_item_mark_text,
407
+ 1.5, 1.5, (2 / 4.0),
408
+ @default_item2_mark_color)
409
+ end
410
+
411
+ match(*(slide_body + (item_list_item * 3))) do |items|
412
+ setup_sumi_text_item_mark(items, "item3",
413
+ @sumi_item_mark_text,
414
+ 1, 1, (1 / 4.0),
415
+ @default_item3_mark_color)
416
+ end
417
+
418
+ match(*(slide_body + enum_list_item + item_list_item)) do |items|
419
+ setup_sumi_text_item_mark(items, "enum-item1",
420
+ @sumi_item_mark_text,
421
+ 1.5, 1.5, (2 / 4.0),
422
+ @default_enum_item1_mark_color)
423
+ end
424
+
425
+ match(*(slide_body + enum_list_item + (item_list_item * 2))) do |items|
426
+ setup_sumi_text_item_mark(items, "enum-item2",
427
+ @sumi_item_mark_text,
428
+ 1, 1, (1 / 4.0),
429
+ @default_enum_item2_mark_color)
430
+ end
431
+
432
+ match(*(slide_body + desc_list_content + item_list_item)) do |items|
433
+ setup_sumi_text_item_mark(items, "description-item1",
434
+ @sumi_item_mark_text,
435
+ 1.5, 1.5, (2 / 4.0),
436
+ @default_description_item1_mark_color)
437
+ end
438
+
439
+ match(*(slide_body + block_quote + (item_list_item * 1))) do |items|
440
+ setup_sumi_text_item_mark(items, "block-quote-item1",
441
+ @sumi_item_mark_text,
442
+ 1.5, 1.5, (2 / 4.0),
443
+ @default_block_quote_item1_mark_color)
444
+ end
445
+
446
+ #--------------------------------------
447
+ # Text colors adjusted for the dark background
448
+ #--------------------------------------
449
+ match(Slide, "**", Note) do |texts|
450
+ texts.prop_set("foreground", @base_dim_foreground)
451
+ end
452
+
453
+ match("**", ReferText) do |texts|
454
+ texts.prop_set("foreground", @default_link_color)
455
+ end
456
+
457
+ # Doubly emphasized text can't be told apart by color, so make it italic.
458
+ match("**", Emphasis, Emphasis) do |texts|
459
+ texts.prop_set("style", "italic")
460
+ end
461
+
462
+ match("**", MethodKind) do |texts|
463
+ texts.prop_set("foreground", @base_dim_foreground)
464
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-theme-sumi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Shugo Maeda
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rabbit
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ -
17
+ - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ -
25
+ - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 2.0.2
28
+ description: |-
29
+ Sumi-ink dark theme for Rabbit: grayscale palette, text item marks, no frames.
30
+
31
+ Everything except syntax highlighting is built from hueless shades of gray.
32
+ Emphasis is expressed with lightness, weight and italics instead of hue. Item
33
+ marks are drawn as U+25AA (BLACK SMALL SQUARE) characters instead of images or
34
+ shapes, and are the same at every level. Headline underlines and the frames
35
+ around block quotes and code blocks are removed; those blocks are shown as
36
+ rounded panels one step lighter than the background.
37
+ email:
38
+ - shugo@ruby-lang.org
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - LICENSE
44
+ - README.md
45
+ - Rakefile
46
+ - config.yaml
47
+ - pdf/theme-benchmark-en.pdf
48
+ - pdf/theme-benchmark-ja.pdf
49
+ - theme.rb
50
+ homepage: "http://theme.rabbit-shocker.org/themes/sumi/"
51
+ licenses:
52
+ - GPL-2.0-or-later
53
+ metadata: {}
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ -
60
+ - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ -
66
+ - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ requirements: []
70
+ rubygems_version: 4.1.0.dev
71
+ specification_version: 4
72
+ summary: rabbit-theme-sumi
73
+ test_files: []