aboutsummaryrefslogtreecommitdiff
path: root/src/Colour.ts
blob: 4f2c4a615b11e2fdf290c2d37ec061f0126381a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import {Vector} from './Vector';

export class Colour extends Vector {
  constructor(readonly r: number, readonly g: number, readonly b: number) {
    super(r, g, b);
  }

  static fromVector(vector: Vector): Colour {
    return new Colour(vector.x, vector.y, vector.z);
  }

  toVector(): Vector {
    return new Vector(this.r, this.g, this.b);
  }
}