@compositive/foundation
Version:
Compositive framework foundation package.
29 lines (26 loc) • 891 B
JavaScript
import { Equals } from '@compositive/commons-predicates';
import { Color } from './Color.js';
class Shade extends Color {
constructor(colorScale, index, colorValue) {
super(colorValue);
this.colorScale = colorScale;
this.index = index;
}
transposeOn(otherScale) {
return otherScale.get(this.index);
}
backward(steps = 1, outOfBoundariesMethod = "none") {
return this.colorScale.get(this.index - steps, outOfBoundariesMethod);
}
frontward(steps = 1, outOfBoundariesMethod = "none") {
return this.colorScale.get(this.index + steps, outOfBoundariesMethod);
}
[Equals](other) {
const ShadeClass = this.constructor;
return (other instanceof ShadeClass &&
other.hex === this.hex &&
other.index === this.index);
}
}
export { Shade };
//# sourceMappingURL=Shade.js.map