All files / games/src/colors colors.ts

100% Statements 27/27
100% Branches 3/3
100% Functions 3/3
100% Lines 27/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x 1x 1x 1x 1x 1x 1x 1x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 23x 23x 25x  
import * as ROT from "rot-js";
 
export interface ColorInterface {
    red: number;
    green: number;
    blue: number;
}
 
export class Color implements ColorInterface {
    public readonly red: number;
 
    public readonly green: number;
 
    public readonly blue: number;
 
    private readonly rot = ROT.Color;
 
    public constructor(red: number, green: number, blue: number) {
        this.red = red;
        this.green = green;
        this.blue = blue;
    }
 
    public toRGB(): string {
        return this.rot.toRGB([this.red, this.green, this.blue]);
    }
}