Reformat code
This commit is contained in:
parent
6e27539eca
commit
420cd788c4
1 changed files with 10630 additions and 2646 deletions
28
src/app/model/color.ts
Normal file
28
src/app/model/color.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { IColor } from '../interfaces/persistance/color';
|
||||
import { Base } from './base';
|
||||
|
||||
export class Color extends Base implements IColor {
|
||||
constructor(props: IColor) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
// Only here to prevent ts warnings.
|
||||
h: number;
|
||||
s: number;
|
||||
l: number;
|
||||
|
||||
public lighten(by: number) {
|
||||
const newL = this.l + by;
|
||||
if (this.l > 100) {
|
||||
this.l = 100;
|
||||
} else if (this.l < 0) {
|
||||
this.l = 0;
|
||||
}
|
||||
|
||||
return new Color({ h: this.h, s: this.s, l: newL });
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
return `hsl(${this.h}, ${this.s}%, ${this.l}%)`;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue