master
宇天 2021-12-06 15:50:26 +08:00
parent a1f5e065b4
commit 6ac40d81c3
5 changed files with 25 additions and 11 deletions

View File

@ -41,6 +41,10 @@ cal -m 5 # 打印当前年份的 指定月份
## 更新日志
### v1.0.2
* 修复当天农历是3个字时的排版异常
* 周末的农历增加暗红色显示
### v1.0.0
* 完成农历显示、公历节日及农历节日的显示

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "bash-calendar",
"description": "终端版万年历",
"version": "1.0.1",
"version": "1.0.2",
"author": "yutent <yutent.io@gmail.com>",
"bin": {
"calendar": "index.js",

View File

@ -137,7 +137,7 @@ function drawTbody(year, month) {
case 1:
if (tmp.picked) {
tr += chalk.bgRed.whiteBright.bold(' '.repeat(4) + tmp.day + ' '.repeat(4)) + VLINE
tr += ' ' + chalk.bgRed.whiteBright.bold(' ' + tmp.day + ' ') + ' ' + VLINE
} else {
// 有grey字段的, 优先置灰, 这种为 非本月份的日期
if (tmp.grey) {
@ -154,15 +154,25 @@ function drawTbody(year, month) {
break
case 2:
let pad = 5
if (tmp.lunar) {
pad = (10 - tmp.lunar.length * 2) / 2 - 2
}
if (tmp.picked) {
tr += chalk.bgRed.white.bold(' '.repeat(3) + tmp.lunar + ' '.repeat(3)) + VLINE
tr +=
' ' +
chalk.bgRed.white.bold(' '.repeat(pad) + tmp.lunar + ' '.repeat(pad)) +
' ' +
VLINE
} else {
let pad = 5
if (tmp.lunar) {
pad = (10 - tmp.lunar.length * 2) / 2
tmp.lunar = tmp.highlight ? chalk.cyan.dim(tmp.lunar) : chalk.grey(tmp.lunar)
tmp.lunar = tmp.highlight
? chalk.cyan.dim(tmp.lunar)
: tmp.weekend
? chalk.red.dim(tmp.lunar)
: chalk.grey(tmp.lunar)
}
tr += ' '.repeat(pad) + tmp.lunar + ' '.repeat(pad) + VLINE
tr += ' '.repeat(pad + 2) + tmp.lunar + ' '.repeat(pad + 2) + VLINE
}
break
}

View File

@ -285,7 +285,7 @@ export const FESTIVALS = {
// 公历节日(不全, 仅国内常用的)
export const SOLAR_FESTIVALS = {
'1.1': '元旦',
'1.1': '元旦',
'2.14': '情人节',
'3.8': '妇女节',
'3.12': '植树节',