How to use the @swim/color.Color.parse 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 / transit / ui / main / kpi / Kpi2ViewController.ts View on Github external
updateData(key: Value, value: Value) {
    // console.log('updateData: k: ', key, ' v: ', value);
    const sliceColors = [Color.parse("#00a6ed"), Color.parse("#7ed321"),
                          Color.parse("#c200fb"), Color.parse("#50e3c2"),
                          Color.parse("#57b8ff"), Color.parse("#5aff15"),
                          Color.parse("#55dde0"), Color.parse("#f7aef8")];

    const tween: Transition = Transition.duration(1000);
    const id = key.get("id").stringValue() || '';
    const index = key.get("index").numberValue() || 0;
    const sliceColor = sliceColors[index % 8];
    const sliceValue = value.numberValue() || 0;
    const pie = this.pieView;
    if (sliceValue > 0) {
      let slice: SliceView = pie.getChildView(id) as SliceView;
      if (slice) {
        slice.value(sliceValue, tween);
        // slice.label().text(sliceValue.toFixed());
      } else {
        slice = new SliceView()
            .value(sliceValue)
            .sliceColor(sliceColor)
github swimos / transit / ui / main / kpi / Kpi2ViewController.ts View on Github external
updateData(key: Value, value: Value) {
    // console.log('updateData: k: ', key, ' v: ', value);
    const sliceColors = [Color.parse("#00a6ed"), Color.parse("#7ed321"),
                          Color.parse("#c200fb"), Color.parse("#50e3c2"),
                          Color.parse("#57b8ff"), Color.parse("#5aff15"),
                          Color.parse("#55dde0"), Color.parse("#f7aef8")];

    const tween: Transition = Transition.duration(1000);
    const id = key.get("id").stringValue() || '';
    const index = key.get("index").numberValue() || 0;
    const sliceColor = sliceColors[index % 8];
    const sliceValue = value.numberValue() || 0;
    const pie = this.pieView;
    if (sliceValue > 0) {
      let slice: SliceView = pie.getChildView(id) as SliceView;
      if (slice) {
        slice.value(sliceValue, tween);
        // slice.label().text(sliceValue.toFixed());
      } else {
github swimos / transit / ui / main / kpi / Kpi2ViewController.ts View on Github external
updateData(key: Value, value: Value) {
    // console.log('updateData: k: ', key, ' v: ', value);
    const sliceColors = [Color.parse("#00a6ed"), Color.parse("#7ed321"),
                          Color.parse("#c200fb"), Color.parse("#50e3c2"),
                          Color.parse("#57b8ff"), Color.parse("#5aff15"),
                          Color.parse("#55dde0"), Color.parse("#f7aef8")];

    const tween: Transition = Transition.duration(1000);
    const id = key.get("id").stringValue() || '';
    const index = key.get("index").numberValue() || 0;
    const sliceColor = sliceColors[index % 8];
    const sliceValue = value.numberValue() || 0;
    const pie = this.pieView;
    if (sliceValue > 0) {
      let slice: SliceView = pie.getChildView(id) as SliceView;
      if (slice) {
        slice.value(sliceValue, tween);
        // slice.label().text(sliceValue.toFixed());
      } else {
        slice = new SliceView()
github swimos / traffic / ui / main / kpi / VehicleBackupKpiViewController.ts View on Github external
get primaryColor(): Color {
    return Color.parse("#d90c25");
  }
github swimos / traffic / ui / main / map / IntersectionPopoverViewController.ts View on Github external
didSetView(view: PopoverView): void {
    view.width(240)
        .height(360)
        .display('flex')
        .flexDirection('column')
        .borderRadius(5)
        .padding(10)
        .backgroundColor(Color.parse("#071013").alpha(0.9))
        .backdropFilter("blur(2px)")
        .color("#ffffff");

    const intersection = this._info;

    const header = view.append("header")
      .display('flex')
      .alignItems('center');
    header.append("div")
      .borderRadius(20)
      .backgroundColor('#00a6ed')
      .padding([3,6,3,6])
      .marginRight(5)
      .fontSize(15)
      .color("#000000")
      .text(`${intersection.id}`);
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / ColorOrStringAttributeAnimator.ts View on Github external
get: function (this: ColorOrStringAttributeAnimator): Color | string | null | undefined {
      let value = this._value;
      if (value === void 0) {
        const attributeValue = this.attributeValue;
        if (attributeValue) {
          try {
            value = Color.parse(attributeValue);
          } catch (swallow) {
            value = attributeValue;
          }
        }
      }
      return value;
    },
    enumerable: true,
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / ColorOrStringStyleAnimator.ts View on Github external
get: function (this: ColorOrStringStyleAnimator): Color | string | null | undefined {
      let value = this._value;
      if (value === void 0) {
        const propertyValue = this.propertyValue;
        if (propertyValue) {
          try {
            value = Color.parse(propertyValue);
          } catch (swallow) {
            value = propertyValue;
          }
        }
      }
      return value;
    },
    enumerable: true,
github swimos / traffic / ui / main / kpi / PedestrianBackupKpiViewController.ts View on Github external
get primaryColor(): Color {
    return Color.parse("#c200fa");
  }

@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