You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(uui-swatch): ability to overwrite displayed color with a css custom prop (#649)
* ability to overwrite displayed color with a css custom prop
* use color prop instead
* refactor, get rid of colord and other things
* correct css filter implementation
---------
Co-authored-by: Jacob Overgaard <[email protected]>
* Value of the swatch. Should be a valid hex, hexa, rgb, rgba, hsl or hsla string. Should fulfill this [css spec](https://www.w3.org/TR/css-color-4/#color-type). If not provided element will look at its text content.
33
-
*
34
-
* @attr
26
+
* Value of the swatch. This will become the color value if color is left undefined, see the property `color` for more details.
* Color of the swatch. Should be a valid hex, hexa, rgb, rgba, hsl or hsla string. Should fulfill this [css spec](https://www.w3.org/TR/css-color-4/#color-type). If not provided element will look at its text content.
41
+
*/
42
+
@property()
43
+
getcolor(): string|undefined{
44
+
returnthis._color;
45
+
}
46
+
setcolor(newValue: string){
47
+
constoldValue=this._color;
48
+
this._color=newValue;
49
+
this.requestUpdate('color',oldValue);
50
+
}
51
+
private_color?: string;
46
52
47
53
/**
48
54
* Determines if the options is disabled. If true the option can't be selected
@@ -58,62 +64,24 @@ export class UUIColorSwatchElement extends LabelMixin(
* Colord object instance based on the value provided to the element. If the value is not a valid color, it falls back to black (like Amy Winehouse). For more information about Colord, see [Colord](https://omgovich.github.io/colord/)
65
-
*
66
-
* @memberof UUIColorSwatchElement
67
-
*/
68
-
getcolor(): Colord|null{
69
-
returnthis._color;
70
-
}
71
-
72
-
setcolor(_){
73
-
// do nothing, this is just to prevent the color from being set from outside
0 commit comments