How to use the @swim/color.Color.fromAny function in @swim/color

To help you get started, we’ve selected a few @swim/color examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / ColorOrStringAttributeAnimator.ts View on Github external
let _this: ColorOrStringAttributeAnimator = function (value?: AnyColor | string | null, tween?: Tween): Color | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Color.parse(value);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Color.fromAny(value);
          }
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as ColorOrStringAttributeAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / ColorOrStringStyleAnimator.ts View on Github external
let _this: ColorOrStringStyleAnimator = function (value?: AnyColor | string | null, tween?: Tween, priority?: string | null): Color | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Color.parse(value);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Color.fromAny(value);
          }
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as ColorOrStringStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / ColorAttributeAnimator.ts View on Github external
let _this: ColorAttributeAnimator = function (value?: AnyColor | null, tween?: Tween): Color | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Color.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as ColorAttributeAnimator;
    (_this as any).__proto__ = this;
github swimos / ripple / ui / main / MirrorView.ts View on Github external
constructor(id?: Value, mode: MirrorMode = MirrorMode.default) {
    super();
    if (id === void 0) {
      id = Text.from(Data.random(6).toBase64());
    }
    this.onMouseDown = this.onMouseDown.bind(this);
    this.onMouseMove = this.onMouseMove.bind(this);
    this.onMouseUp = this.onMouseUp.bind(this);
    this.onTouchStart = this.onTouchStart.bind(this);
    this.onTouchMove = this.onTouchMove.bind(this);
    this.onTouchCancel = this.onTouchCancel.bind(this);
    this.onTouchEnd = this.onTouchEnd.bind(this);
    this.id = id;
    this.mode = mode;
    this.color = Color.fromAny(MirrorView.colors[Math.floor(MirrorView.colors.length * Math.random())]);
    this.captive = false;
    this._touchCount = 0;
    this._presses = {};
  }
github swimos / swim / swim-system-js / swim-ui-js / @swim / view / main / member / ColorMemberAnimator.ts View on Github external
let _this: ColorMemberAnimator = function (value?: AnyColor | null, tween?: Tween): Color | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Color.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as ColorMemberAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / ColorStyleAnimator.ts View on Github external
let _this: ColorStyleAnimator = function (value?: AnyColor | null, tween?: Tween, priority?: string | null): Color | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Color.fromAny(value);
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as ColorStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-system-js / swim-ui-js / @swim / view / main / member / ColorMemberAnimator.ts View on Github external
this: ColorMemberAnimator, view: V, value?: AnyColor | null,
      transition?: Transition | null, inherit?: string | null): ColorMemberAnimator {
    let _this: ColorMemberAnimator = function (value?: AnyColor | null, tween?: Tween): Color | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Color.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as ColorMemberAnimator;
    (_this as any).__proto__ = this;
    if (value !== null && value !== void 0) {
      value = Color.fromAny(value);
    }
    _this = _super.call(_this, view, value, transition, inherit) || _this;
    return _this;
  } as unknown as MemberAnimatorConstructor;
  __extends(ColorMemberAnimator, _super);
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / member / ColorMemberAnimator.ts View on Github external
let _this: ColorMemberAnimator = function (value?: AnyColor | null, tween?: Tween): Color | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Color.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as ColorMemberAnimator;
    (_this as any).__proto__ = this;

@swim/color

RGB and HSL color types with color-space-aware operators, conversions, and parsers

Apache-2.0
Latest version published 5 years ago

Package Health Score

61 / 100
Full package analysis

Similar packages