S8-mktg-aero/aero/content/AeroColor.js
2025-05-25 19:37:12 +02:00

32 lines
589 B
JavaScript

export class AeroColor {
static BLACK = new AeroColor(0, 0, 0);
constructor(red, green, blue, transparency = -2) {
super();
this.r = red;
this.g = green;
this.b = blue;
this.a = transparency;
}
/**
*
* @param {HTMLElement} target
*/
applyAsBackground(target) {
if(this.a > -1){
target.style.backgroundColor = `rgb(${this.r},${this.g},${this.b},${this.a})`;
}
else{
target.style.backgroundColor = `rgb(${this.r},${this.g},${this.b})`;
}
}
}