Skip to content

Commit

Permalink
Fix Linux Console default BG color
Browse files Browse the repository at this point in the history
  • Loading branch information
cronvel committed Jan 21, 2021
1 parent b46bbbc commit 32c50f3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ logs
results
build
.grunt
sample/__issue.js
__issue.js
package-lock.json

node_modules
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

v1.45.5
-------

Fix Linux Console default BG color


v1.45.4
-------

Expand Down
18 changes: 9 additions & 9 deletions lib/Palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ const termkit = require( './termkit.js' ) ;
The original 6x6x6 colors cube shipped with terminal software is rather boring and miss the spot.
Lot of useless colors, lot of over-saturated hideous colors, and useful colors cannot be shaded/hilighted easily.
It also waste color register with 24 grayscale colors... way too much details on this area, and is unlikely to be used.
It also wastes plenty of color registers with 24 its grayscale colors... way too much details on this area that is unlikely to be used.
This new custom palette have 4 parts :
This new custom palette have 4 regions:
* The first 16 colors are reserved, it always maps to ANSI colors and depends on the terminal settings entirely.
* Then comes a 216-color adaptive palette based upon 12 user-provided colors that represent 12 hue of the wheel,
with auto-generated variation of shades, tint and desaturation.
That is: 12 colors * 6 level of tint/shade * 3 level of desaturation = 216 colors.
For maximum reliance, there are computed using the HCL (Lab) colorspace.
This provide some good hilight and dim effect
For maximum reliance, they are computed using the HCL (Lab) colorspace.
This provides some good hilight and dim effect.
* Then comes 13 extra colors fully defined by the user, they must be precise and beautiful colors that are missing
in the 216-colors part, and that have great added values.
* And finally comes 11 gray scale colors (going 0%, 10%, 20%... 100% of HCL lightness)
* And finally comes 11 gray scale colors (going 0%, 10%, 20%, ..., 100% of HCL lightness)
*/

const defaultAdaptivePaletteDef = [
Expand Down Expand Up @@ -347,10 +347,10 @@ Palette.prototype.clStep = function( chromaColor , cAdjust , lAdjust , fixRgb =

if ( ! fixRgb || ! chromaColor.clipped ) { return chromaColor ; }

// RGB is clipped and should be fixed
// The most critical part is when the hue get changed, since it's arguably the most important information
// Lightness is somewhat important too, but less than hue a bit more than the Chroma
// Chroma will be preserved if the adjustement is greater on it than on lightness
// RGB is clipped and should be fixed.
// The most critical part is when the hue get changed, since it's arguably the most important information.
// Lightness is somewhat important too, but less than hue and a bit more than the Chroma.
// Chroma will be preserved if the adjustement is greater on it than on lightness.

//preserveLOverC = Math.abs( lAdjust ) >= Math.abs( cAdjust ) ;
preserveLOverC = Math.abs( lAdjust ) >= cAdjust ;
Expand Down
16 changes: 8 additions & 8 deletions lib/document/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,38 @@ function Button( options ) {

if ( ! Array.isArray( options.content ) ) { options.content = [ options.content || '' ] ; }

this.blurContent =
this.blurContent =
options.blurContent ? ( Array.isArray( options.blurContent ) ? options.blurContent : [ options.blurContent ] ) :
options.content ;

this.focusContent =
this.focusContent =
options.focusContent ? ( Array.isArray( options.focusContent ) ? options.focusContent : [ options.focusContent ] ) :
options.content ;

this.disabledContent =
this.disabledContent =
options.disabledContent ? ( Array.isArray( options.disabledContent ) ? options.disabledContent : [ options.disabledContent ] ) :
options.content ;

this.submittedContent =
this.submittedContent =
options.submittedContent ? ( Array.isArray( options.submittedContent ) ? options.submittedContent : [ options.submittedContent ] ) :
options.content ;

this.turnedOnBlurContent =
this.turnedOnBlurContent =
options.turnedOnBlurContent ? ( Array.isArray( options.turnedOnBlurContent ) ? options.turnedOnBlurContent : [ options.turnedOnBlurContent ] ) :
options.turnedOnContent ? ( Array.isArray( options.turnedOnContent ) ? options.turnedOnContent : [ options.turnedOnContent ] ) :
options.content ;

this.turnedOffBlurContent =
this.turnedOffBlurContent =
options.turnedOffBlurContent ? ( Array.isArray( options.turnedOffBlurContent ) ? options.turnedOffBlurContent : [ options.turnedOffBlurContent ] ) :
options.turnedOffContent ? ( Array.isArray( options.turnedOffContent ) ? options.turnedOffContent : [ options.turnedOffContent ] ) :
options.content ;

this.turnedOnFocusContent =
this.turnedOnFocusContent =
options.turnedOnFocusContent ? ( Array.isArray( options.turnedOnFocusContent ) ? options.turnedOnFocusContent : [ options.turnedOnFocusContent ] ) :
options.turnedOnContent ? ( Array.isArray( options.turnedOnContent ) ? options.turnedOnContent : [ options.turnedOnContent ] ) :
options.content ;

this.turnedOffFocusContent =
this.turnedOffFocusContent =
options.turnedOffFocusContent ? ( Array.isArray( options.turnedOffFocusContent ) ? options.turnedOffFocusContent : [ options.turnedOffFocusContent ] ) :
options.turnedOffContent ? ( Array.isArray( options.turnedOffContent ) ? options.turnedOffContent : [ options.turnedOffContent ] ) :
options.content ;
Expand Down
2 changes: 1 addition & 1 deletion lib/termconfig/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const noBold = '\x1b[22m' ;
const blink = '\x1b[5m' ;
const noBlink = '\x1b[25m' ;
const defaultColor = noBold + '\x1b[39m' ; // back to the default color, most of time it is the same than .white
const bgDefaultColor = noBold + '\x1b[49m' ; // back to the default color, most of time it is the same than .bgBlack
const bgDefaultColor = noBlink + '\x1b[49m' ; // back to the default color, most of time it is the same than .bgBlack



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "terminal-kit",
"version": "1.45.4",
"version": "1.45.5",
"description": "256 colors, keys and mouse, input field, progress bars, screen buffer (including 32-bit composition and image loading), text buffer, and many more... Whether you just need colors and styles, build a simple interactive command line tool or a complexe terminal app: this is the absolute terminal lib for Node.js!",
"main": "lib/termkit.js",
"directories": {
Expand Down

0 comments on commit 32c50f3

Please sign in to comment.