@itwin/core-common
Version:
iTwin.js components common to frontend and backend
35 lines • 1.2 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Symbology
*/
import { ColorDef } from "./ColorDef";
/** An immutable color defined by Hue, Saturation, and Lightness.
* @see [here](https://en.wikipedia.org/wiki/HSL_and_HSV) for difference between HSL and HSV
* @public
*/
export class HSLColor {
/** Hue */
h;
/** Saturation */
s;
/** Lightness */
l;
constructor(hue = 0, saturation = 0, lightness = 0) {
this.h = hue;
this.s = saturation;
this.l = lightness;
}
clone(hue, saturation, lightness) {
return new HSLColor(hue ?? this.h, saturation ?? this.s, lightness ?? this.l);
}
toColorDef(transparency = 0) {
return ColorDef.fromHSL(this.h, this.s, this.l, transparency);
}
static fromColorDef(val) {
return val.toHSL();
}
}
//# sourceMappingURL=HSLColor.js.map