diff --git a/lib/widget.js b/lib/widget.js index b5042d8..462f55a 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -585,11 +585,11 @@ function Element(options) { this.fg = convert(options.fg); this.bg = convert(options.bg); - this.bold = options.bold ? 1 : 0; - this.underline = options.underline ? 2 : 0; - this.blink = options.blink ? 4 : 0; - this.inverse = options.inverse ? 8 : 0; - this.invisible = options.invisible ? 16 : 0; + this.bold = options.bold; + this.underline = options.underline; + this.blink = options.blink; + this.inverse = options.inverse; + this.invisible = options.invisible; this.hidden = options.hidden || false; this.fixed = options.fixed || false; @@ -603,11 +603,6 @@ function Element(options) { this.border.fg = convert(this.border.fg); this.border.bg = convert(this.border.bg); this.border.ch = this.border.ch || ' '; - this.border.bold = this.border.bold ? 1 : 0; - this.border.underline = this.border.underline ? 2 : 0; - this.border.blink = this.border.blink ? 4 : 0; - this.border.inverse = this.border.inverse ? 8 : 0; - this.border.invisible = this.border.invisible ? 16 : 0; } if (options.clickable) { @@ -1355,11 +1350,11 @@ function List(options) { this.selectedBg = convert(options.selectedBg); this.selectedFg = convert(options.selectedFg); - this.selectedBold = options.selectedBold ? 1 : 0; - this.selectedUnderline = options.selectedUnderline ? 2 : 0; - this.selectedBlink = options.selectedBlink ? 4 : 0; - this.selectedInverse = options.selectedInverse ? 8 : 0; - this.selectedInvisible = options.selectedInvisible ? 16 : 0; + this.selectedBold = options.selectedBold; + this.selectedUnderline = options.selectedUnderline; + this.selectedBlink = options.selectedBlink; + this.selectedInverse = options.selectedInverse; + this.selectedInvisible = options.selectedInvisible; this.mouse = options.mouse || false; @@ -2012,11 +2007,11 @@ function convert(color) { } function sattr(obj, fg, bg) { - return (((obj.invisible << 18) - + (obj.inverse << 18) - + (obj.blink << 18) - + (obj.bold << 18) - + (obj.underline << 18)) + return ((((obj.invisible ? 16 : 0) << 18) + | ((obj.inverse ? 8 : 0) << 18) + | ((obj.blink ? 4 : 0) << 18) + | ((obj.underline ? 2 : 0) << 18)) + | ((obj.bold ? 1 : 0) << 18) | (fg << 9)) | bg; }