Skip to content

Commit

Permalink
updated getColor module && clear console when create a window
Browse files Browse the repository at this point in the history
  • Loading branch information
Raisess committed Nov 8, 2020
1 parent 1f8d280 commit e638103
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "term-display",
"version": "1.4.0",
"version": "1.4.1",
"description": "Terminal display lib.",
"main": "./dist/Display.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/Display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class Display {
this.size.height = Math.round(size.height);
this.whiteSpace = whiteSpace ? whiteSpace : this.whiteSpace;

this.clear(false); // Creates the window.
this.clear(); // Creates the window.
}

// Show display.
Expand Down
2 changes: 1 addition & 1 deletion src/examples/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const anim: any = setInterval(() => {
display.clear();

for (let j: number = 0; j < pixel.length; j++) {
display.setPixel({
display.setPixel({
x: i === size.width - 1 ? pixel[j].x = size.width - (pixel[j].value.length - (pixel[j].value.length - (pixel[j].value.length - 1))) : pixel[j].x + i,
y: pixel[j].y
}, pixel[j].value, pixel[j].color);
Expand Down
11 changes: 5 additions & 6 deletions src/modules/getColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { IColor } from "../interfaces/IColor";
import { colors } from "../data/colors";

export default function getColor(colorValue: number): IColor {
const colorNames: Array<[string, unknown]> = Object.entries(colors);
const colorValues: Array<number> = Object.values(colors);
const colorTuples: Array<[string, number]> = Object.entries(colors);

for (let i: number = 0; i < colorValues.length; i++) {
if (colorValue === colorValues[i]) {
for (let i: number = 0; i < colorTuples.length; i++) {
if (colorValue === colorTuples[i][1]) {
return {
name: colorNames[i][0],
value: colorValues[i],
name: colorTuples[i][0],
value: colorTuples[i][1],
type: "PX"
};
}
Expand Down

0 comments on commit e638103

Please sign in to comment.