oops broke color table

box-drawing
Ondřej Hruška 7 years ago
parent 0468b3adf5
commit e2c57ac80a
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 7
      js/lib/color_utils.js
  2. 6
      js/term/themes.js

@ -113,6 +113,13 @@ function pad (n) {
return n return n
} }
exports.rgb255_to_hex = function (r, g, b) {
r = r.toString(16)
g = g.toString(16)
b = b.toString(16)
return `#${pad(r)}${pad(g)}${pad(b)}`
}
exports.rgb_to_hex = function (r, g, b) { exports.rgb_to_hex = function (r, g, b) {
r = Math.round(r * 255).toString(16) r = Math.round(r * 255).toString(16)
g = Math.round(g * 255).toString(16) g = Math.round(g * 255).toString(16)

@ -1,5 +1,5 @@
const $ = require('../lib/chibi') const $ = require('../lib/chibi')
const { rgb_to_hex } = require('../lib/color_utils') const { rgb255_to_hex } = require('../lib/color_utils')
const themes = exports.themes = [ const themes = exports.themes = [
[ // 0 - Tango - terminator [ // 0 - Tango - terminator
@ -84,14 +84,14 @@ exports.buildColorTable = function () {
let redValue = red * 40 + (red ? 55 : 0) let redValue = red * 40 + (red ? 55 : 0)
let greenValue = green * 40 + (green ? 55 : 0) let greenValue = green * 40 + (green ? 55 : 0)
let blueValue = blue * 40 + (blue ? 55 : 0) let blueValue = blue * 40 + (blue ? 55 : 0)
colorTable256.push(rgb_to_hex(redValue, greenValue, blueValue)) colorTable256.push(rgb255_to_hex(redValue, greenValue, blueValue))
} }
} }
} }
// colors 232-255 are a grayscale ramp, sans black and white // colors 232-255 are a grayscale ramp, sans black and white
for (let gray = 0; gray < 24; gray++) { for (let gray = 0; gray < 24; gray++) {
let value = gray * 10 + 8 let value = gray * 10 + 8
colorTable256.push(rgb_to_hex(value, value, value)) colorTable256.push(rgb255_to_hex(value, value, value))
} }
return colorTable256 return colorTable256

Loading…
Cancel
Save