Draw Github Commit Calendar Image Like in Bash.
- support any shape!
- customize!
- draw summary number!
# import function
source calendarimg.sh
# set flags
# set data
for i in {0..362};do
CALENDARIMG_DATA[i]=$(( i % 7 ));
done
# draw & save to file
calendarimg_generate "output.ppm"
Almost all flags/configurations support be set both before/after import, except those array.
CALENDARIMG_CELL_WIDTH
: the width of calendar item, a calendar item is a square.CALENDARIMG_BORDER
: the border width of calendar item.CALENDARIMG_PADDING
: the width between two calendar item.CALENDARIMG_MARGIN
: the space width between side calendar item and canvas boundary.
CALENDARIMG_COLS
: how many columns.CALENDARIMG_ROWS
: how many rows.CALENDARIMG_MAJRO
: col major or row marjor, default isrow
.
The default shape is set the direction defined by CALENDARIMG_MAJOR
to 7, and calculate the other side
by divided by total data size.
If either CALENDARIMG_COLS
or CALENDARIMG_ROWS
is set, the other side is calculated.
If both CALENDARIMG_COLS
and CALENDARIMG_ROWS
are set, they won't be calcuated, but the product should greater than total data size.
-
border style: availble values:
solid
,dashed
,hidden
CALENDARIMG_BORDER_STYLE
: the border style when there is data, default tosolid
CALENDARIMG_NODATA_BORDER_STYLE
: the border style when there is no data, default todashed
CALENDARIMG_DATA_ORDER
, default is normal
, availble choice is reversed
.
- when it is
normal
,${CALENDARIMG_DATA[0]
is set to left-top. - when it is
reversed
,${CALENDARIMG_DATA[0]
is set to right-bottom.
CALENDARIMG_LEVEL_LIMITS
: limits for every level except last.CALENDARIMG_LEVEL_COLORS
: colors for every level, in format of{r} {g} {b}
. e.g.192 192 192
CALENDARIMG_LEVEL_COLORS
and CALENDARIMG_LEVEL_LIMITS
are arrays.
${#CALENDARIMG_LEVEL_COLORS[@]} = ${#CALENDARIMG_LEVEL_LIMITS[@]} + 1
.
CALENDARIMG_COLOR_BG
: backgroud colorCALENDARIMG_COLOR_BR
: border colorCALENDARIMG_COLOR_NR
: number color
show a summary number for every rows and cols.
CALENDARIMG_SUMMARY_NUMBER=enabled
use pnm2png
or pnmtopng
See examples