diff --git a/src-ui/src/app/components/common/input/color/color.component.html b/src-ui/src/app/components/common/input/color/color.component.html index a22d4f350..d7b84566c 100644 --- a/src-ui/src/app/components/common/input/color/color.component.html +++ b/src-ui/src/app/components/common/input/color/color.component.html @@ -1,12 +1,12 @@
- +
   
- +
diff --git a/src-ui/src/app/components/common/input/color/color.component.ts b/src-ui/src/app/components/common/input/color/color.component.ts index a7f3452f2..b31259200 100644 --- a/src-ui/src/app/components/common/input/color/color.component.ts +++ b/src-ui/src/app/components/common/input/color/color.component.ts @@ -1,5 +1,6 @@ -import { Component, forwardRef } from '@angular/core'; +import { Component, Input, forwardRef } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; +import { ColorEvent, ColorMode } from 'ngx-color'; import { randomColor } from 'src/app/utils/color'; import { AbstractInputComponent } from '../abstract-input'; @@ -15,6 +16,9 @@ import { AbstractInputComponent } from '../abstract-input'; }) export class ColorComponent extends AbstractInputComponent { + @Input() + colorMode: ColorMode = ColorMode.HEX + constructor() { super() } @@ -23,8 +27,12 @@ export class ColorComponent extends AbstractInputComponent { this.colorChanged(randomColor()) } - colorChanged(value) { - this.value = value - this.onChange(value) + sliderChanged(colorEvent:ColorEvent) { + this.colorChanged(colorEvent.color[this.colorMode].toString()) + } + + colorChanged(color:string) { + this.value = color + this.onChange(color) } }