import { Property } from '../property.js';

export class Color extends Property {
    public static Plain =       new Color('#a6accd');
    public static Punctuator =  new Color('#89ddff');
    public static Tag =         new Color('#f07178');
    public static Attribute =   new Color('#c792ea');
    public static String =      new Color('#c3e88d');
    public static Comment =     new Color('#676e95');

    #color: string;

    private constructor(color: string) {
        super();

        this.#color = color;
    }

    public get color(): string {
        return this.#color;
    }

    public override equals(other: Property): boolean {
        if (!(other instanceof Color)) return false;

        return other.#color === this.#color;
    }

    public override apply(element: HTMLElement): void {
        element.style.color = this.#color;
    }

    public override inspect(indent: number): string {
        return `Color { ${this.#color} }`;
    }
}
