Badges style

This commit is contained in:
Julien Malka 2023-01-21 20:37:35 +01:00
parent 4cbeb9970a
commit cff6c8b50c
Signed by: Luj
GPG key ID: 6FC74C847011FD83
3 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" width="{{ left.width+config.left_pad + right.width+config.right_pad + 5}}" height="40">
<linearGradient id="smooth" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="{{ config.border_radius }}" width="{{ left.width+config.left_pad + right.width+config.right_pad }}" height="20" fill="{{ left.color }}"/>
<rect rx="{{ config.border_radius }}" x="{{ left.width+config.left_pad+5 }}" width="{{ right.width+config.right_pad }}" height="20" fill="{{ right.color }}"/>
<rect x="{{ left.width+config.left_pad+5 }}" width="4" height="20" fill="{{ right.color }}"/>
<rect rx="{{ config.border_radius }}" width="{{ left.width+config.left_pad + right.width+config.right_pad +5 }}" height="20" fill="url(#smooth)"/>
<g fill="#fff" text-anchor="middle" font-family="{{config.font_face}},Verdana,Geneva,sans-serif" font-size="{{config.font_size}}">
<text x="{{ (left.width+config.left_pad) /2+1 }}" y="15" fill="#010101" fill-opacity=".3">{{ left.text }}</text>
<text x="{{ (left.width+config.left_pad) /2+1 }}" y="14">{{ left.text }}</text>
<text x="{{ (left.width+config.left_pad+5) + (right.width+config.right_pad) /2-1 }}" y="15" fill="#010101" fill-opacity=".3">{{ right.text }}</text>
<text x="{{ (left.width+config.left_pad+5) + (right.width+config.right_pad) /2-1 }}" y="14">{{ right.text }}</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -159,7 +159,27 @@ def build_config() -> dict[str, Any]:
util.AnyControlEndpointMatcher(role="admins"),
],
),
"plugins": dict(waterfall_view={}, console_view={}, grid_view={}, badges={}),
"plugins": dict(waterfall_view={}, console_view={}, grid_view={}, badges ={
"left_pad" : 5,
"left_text": "Build Status", # text on the left part of the image
"left_color": "#555", # color of the left part of the image
"right_pad" : 5,
"border_radius" : 5, # Border Radius on flat and plastic badges
# style of the template availables are "flat", "flat-square", "plastic"
"template_name": "flat.svg.j2", # name of the template
"font_face": "DejaVu Sans",
"font_size": 11,
"color_scheme": { # color to be used for right part of the image
"exception": "#007ec6", # blue
"failure": "#e05d44", # red
"retry": "#007ec6", # blue
"running": "#007ec6", # blue
"skipped": "a4a61d", # yellowgreen
"success": "#4c1", # brightgreen
"unknown": "#9f9f9f", # lightgrey
"warnings": "#dfb317" # yellow
}
}),
"change_hook_dialects": dict(
github={
"secret": "hello",

View file

@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" width="{{ left.width+config.left_pad + right.width+config.right_pad + 5}}" height="40">
<linearGradient id="smooth" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="{{ config.border_radius }}" width="{{ left.width+config.left_pad + right.width+config.right_pad }}" height="20" fill="{{ left.color }}"/>
<rect rx="{{ config.border_radius }}" x="{{ left.width+config.left_pad+5 }}" width="{{ right.width+config.right_pad }}" height="20" fill="{{ right.color }}"/>
<rect x="{{ left.width+config.left_pad+5 }}" width="4" height="20" fill="{{ right.color }}"/>
<rect rx="{{ config.border_radius }}" width="{{ left.width+config.left_pad + right.width+config.right_pad +5 }}" height="20" fill="url(#smooth)"/>
<g fill="#fff" text-anchor="middle" font-family="{{config.font_face}},Verdana,Geneva,sans-serif" font-size="{{config.font_size}}">
<text x="{{ (left.width+config.left_pad) /2+1 }}" y="15" fill="#010101" fill-opacity=".3">{{ left.text }}</text>
<text x="{{ (left.width+config.left_pad) /2+1 }}" y="14">{{ left.text }}</text>
<text x="{{ (left.width+config.left_pad+5) + (right.width+config.right_pad) /2-1 }}" y="15" fill="#010101" fill-opacity=".3">{{ right.text }}</text>
<text x="{{ (left.width+config.left_pad+5) + (right.width+config.right_pad) /2-1 }}" y="14">{{ right.text }}</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB