1 # Copyright (C) 2019 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # Self-updating module containing a sample CSS for client-side
5 # customization by users of public-inbox. Used by Makefile.PL
6 package PublicInbox::UserContent;
10 # this sub is updated automatically:
14 * Dark color scheme using 216 web-safe colors, inspired
15 * somewhat by the default color scheme in mutt.
16 * It reduces eyestrain for me, and energy usage for all:
17 * https://en.wikipedia.org/wiki/Light-on-dark_color_scheme
19 * { background:#000; color:#ccc }
22 * Underlined links add visual noise which make them hard-to-read.
23 * Use colors to make them stand out, instead.
25 a { color:#69f; text-decoration:none }
26 a:visited { color:#96f }
28 /* quoted text gets a different color */
32 * these may be used with cgit, too
33 * (cgit uses <div>, public-inbox uses <span>)
41 * highlight 3.x colors (tested 3.18) for displaying blobs.
42 * This doesn't use most of the colors available (I find too many
43 * colors overwhelming), so the #ccc default is commented out.
45 .hl.num { color:#f30 } /* number */
46 .hl.esc { color:#f0f } /* escape character */
47 .hl.str { color:#f30 } /* string */
48 .hl.ppc { color:#f0f } /* preprocessor */
49 .hl.pps { color:#f30 } /* preprocessor string */
50 .hl.slc { color:#09f } /* single-line comment */
51 .hl.com { color:#09f } /* multi-line comment */
52 /* .hl.opt { color:#ccc } */ /* operator */
53 /* .hl.ipl { color:#ccc } */ /* interpolation */
54 /* .hl.lin { color:#ccc } */ /* line-number (unused by public-inbox) */
56 /* keyword groups kw[a-z] */
57 .hl.kwa { color:#ff0 }
58 .hl.kwb { color:#0f0 }
59 .hl.kwc { color:#ff0 }
60 /* .hl.kwd { color:#ccc } */
63 # end of auto-updated sub
68 my $url_prefix = $ibx->base_url($env);
71 * Firefox users: this goes in \$PROFILE_FOLDER/chrome/userContent.css
72 * where \$PROFILE_FOLDER is platform-specific
74 * cf. http://kb.mozillazine.org/UserContent.css
75 * http://kb.mozillazine.org/Profile_folder_-_Firefox
77 * Users of dillo can remove the entire lines with "moz-only"
78 * in them and place the resulting file in ~/.dillo/style.css
80 \@-moz-document url-prefix($url_prefix) { /* moz-only */
82 $preamble . CSS() . "\n} /* moz-only */\n";
85 # Auto-update this file based on the contents of a CSS file:
86 # usage: perl -I lib __FILE__ contrib/css/216dark.css
88 if (scalar(@ARGV) == 1 && -r __FILE__) {
90 open my $ro, '<', $ARGV[0];
91 my $css = do { local $/; <$ro> };
92 $css =~ s/^([ \t]*\S)/\t$1/smg;
93 open my $rw, '+<', __FILE__;
94 my $out = do { local $/; <$rw> };
95 $out =~ s/^sub CSS.*^_\n\}/sub CSS () {\n\t<<'_'\n${css}_\n}/sm;