comparison mod_muc_badge/mod_muc_badge.lua @ 3172:8d2fe3b93c15

mod_muc_badge: Simplify SVG
author Kim Alvefur <zash@zash.se>
date Wed, 04 Jul 2018 23:04:04 +0200
parents 774845606d73
children cd23446eaff1
comparison
equal deleted inserted replaced
3171:f35b2b76df6d 3172:8d2fe3b93c15
33 end 33 end
34 34
35 -- I believe the origins of this template to be in the public domain as per 35 -- I believe the origins of this template to be in the public domain as per
36 -- https://github.com/badges/shields/blob/master/LICENSE.md 36 -- https://github.com/badges/shields/blob/master/LICENSE.md
37 local template = module:get_option_string("badge_template", [[ 37 local template = module:get_option_string("badge_template", [[
38 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="144" height="20"> 38 <?xml version="1.0"?>
39 <linearGradient id="b" x2="0" y2="100%"> 39 <svg xmlns="http://www.w3.org/2000/svg" width="144" height="20">
40 <stop offset="0" stop-color="#bbb" stop-opacity=".1"/> 40 <linearGradient id="b" x2="0" y2="100%">
41 <stop offset="1" stop-opacity=".1"/> 41 <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
42 </linearGradient> 42 <stop offset="1" stop-opacity=".1"/>
43 <clipPath id="a"> 43 </linearGradient>
44 <rect width="144" height="20" rx="3" fill="#fff"/> 44 <clipPath id="a">
45 </clipPath> 45 <rect width="144" height="20" rx="3" fill="#fff"/>
46 <g clip-path="url(#a)"> 46 </clipPath>
47 <path fill="#555" d="M0 0h69v20H0z"/> 47 <g clip-path="url(#a)">
48 <path fill="#fe7d37" d="M69 0h75v20H69z"/> 48 <path fill="#555" d="M0 0h69v20H0z"/>
49 <path fill="url(#b)" d="M0 0h144v20H0z"/> 49 <path fill="#fe7d37" d="M69 0h75v20H69z"/>
50 </g> 50 <path fill="url(#b)" d="M0 0h144v20H0z"/>
51 <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> 51 </g>
52 <text x="355" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="590">{label}</text> 52 <g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
53 <text x="355" y="140" transform="scale(.1)" textLength="590">{label}</text> 53 <text fill="#010101" y="14" x="0" textLength="59">{label}</text>
54 <text x="1055" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="650">{number}</text> 54 <text y="13" x="0" textLength="59">{label}</text>
55 <text x="1055" y="140" transform="scale(.1)" textLength="650">{number}</text> 55 <text fill="#010101" y="14" x="59" textLength="65">{number}</text>
56 </g> 56 <text y="13" x="59" textLength="65">{number}</text>
57 </g>
57 </svg> 58 </svg>
58 ]]); 59 ]]);
59 template = assert(require "util.template"(template)); 60 template = assert(require "util.template"(template));
60 61
61 local label = module:get_option_string("badge_label", "Chatroom"); 62 local label = module:get_option_string("badge_label", "Chatroom");