From 29875bfa308fc52b5faee794145839794b9ab096 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Fri, 29 May 2015 21:59:22 -0400 Subject: support bold html output --- src/util.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index bd648cf..f62106b 100644 --- a/src/util.c +++ b/src/util.c @@ -225,10 +225,16 @@ void print_handler(struct player_t *player) else if(last_buy->price.cents > stock->current_price.cents) col = COL_RED; + if(ABS((signed)last_buy->price.cents - (signed)stock->current_price.cents) >= BOLD_THRESHOLD) + use_bold(); + use_color(col); output("%5llu.%02llu", stock->current_price.cents / 100, stock->current_price.cents % 100); stop_color(col); + if(ABS((signed)last_buy->price.cents - (signed)stock->current_price.cents) >= BOLD_THRESHOLD) + stop_bold(); + output(" = $%6llu.%02llu\n", total_value / 100, total_value % 100); portfolio_value += stock->current_price.cents * stock->count; @@ -603,3 +609,20 @@ void batch_init(void) { batch_mode = true; } + +void use_bold(void) +{ + /* curses mode always has A_BOLD set, so this only applies to HTML mode */ + if(html_out) + { + output(""); + } +} + +void stop_bold(void) +{ + if(html_out) + { + output(""); + } +} -- cgit v1.1