--- /usr/bin/gitstats 2013-02-28 12:18:23.000000000 +0900
+++ /tmp/gitstats 2013-08-23 01:52:22.692719564 +0900
@@ -848,12 +848,19 @@
commits = 0
if commits != 0:
f.write('<td')
- r = 127 + int((float(commits) / data.activity_by_hour_of_week_busiest) * 128)
- f.write(' style="background-color: rgb(%d, 0, 0)"' % r)
+ import math
+ t = float(commits-1) / (data.activity_by_hour_of_week_busiest-1)
+ if t < 0.5:
+ g = 255
+ r = int(127.5 - math.cos(t*math.pi*2) * 127.5)
+ else:
+ r = 255
+ g = int(127.5 - math.cos(t*math.pi*2) * 127.5)
+ f.write(' style="background-color: rgb(%d, %d, 0)"' % (r, g))
f.write('>%d</td>' % commits)
else:
f.write('<td></td>')
f.write('</tr>')
f.write('</table>')
他の箇所も同じ変更を行なって, git-hub に push しよう.
2013-08-23
gitstats の曜日統計をカラーにする
gitstats の 曜日統計は, 数値に応じて赤色-赤褐色の色が着くが, あまり綺麗ではない.
緑-黄-赤の色をつける様に変更した.
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿