46 lines
1.3 KiB
Groovy
46 lines
1.3 KiB
Groovy
void call(String stepName, String boxColor = 'green', String textColor = 'white', String styleName = 'default') {
|
|
Map colors = [
|
|
black: '\u001b[30m',
|
|
red: '\u001b[31m',
|
|
green: '\u001b[32m',
|
|
yellow: '\u001b[33m',
|
|
blue: '\u001b[34m',
|
|
magenta: '\u001b[35m',
|
|
cyan: '\u001b[36m',
|
|
white: '\u001b[40;37m',
|
|
reset: '\u001b[0m',
|
|
]
|
|
|
|
Map boxStyles = [
|
|
default: [
|
|
tr: '╔',
|
|
tl: '╗',
|
|
sd: '║',
|
|
vr: '═',
|
|
br: '╚',
|
|
bl: '╜'
|
|
],
|
|
plain: [
|
|
tr: '+',
|
|
tl: '+',
|
|
sd: '|',
|
|
vr: '-',
|
|
br: '+',
|
|
bl: '+'
|
|
]
|
|
]
|
|
|
|
Map style = boxStyles[styleName]
|
|
|
|
stepBanner = style['sd'] + " ${colors[textColor]}$stepName${colors['reset']}${colors[boxColor]} " + style['sd']
|
|
bannerWidth = stepName.length() + 6
|
|
|
|
top = style['tr'] + (style['vr'] * bannerWidth) + style['tl']
|
|
bottom = style['br'] + (style['vr'] * bannerWidth) + style['bl']
|
|
ansiColor('css') {
|
|
echo "${colors[boxColor]}$top\n$stepBanner\n$bottom${colors['reset']}"
|
|
}
|
|
}
|
|
|
|
// ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬
|