Skip to content

Commit

Permalink
Improve percentage signs
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Aug 18, 2019
1 parent befc7e5 commit 18af013
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/print/stats/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ const serializePercentage = function({ stat }) {
const percentage = Math.abs(Math.floor(stat * PERCENTAGE_SCALE))

if (stat >= 0) {
return `+${percentage}%`
return `${UP_ARROW} ${percentage}%`
}

return `-${percentage}%`
return `${DOWN_ARROW} ${percentage}%`
}

const PERCENTAGE_SCALE = 1e2
// Works on CP437 too
const UP_ARROW = '\u2191'
const DOWN_ARROW = '\u2193'

const serializeArray = function({ stat, scale, unit, decimals }) {
return stat.map(statA =>
Expand Down

0 comments on commit 18af013

Please sign in to comment.