How to use the tns-core-modules/color.Color function in tns-core-modules

To help you get started, we’ve selected a few tns-core-modules 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 jlooper / picme / app / components / Home.vue View on Github external
if (id == 1) {
				if (this.$store.state.counter.humanScore > this.$store.state.counter.botScore) {
					msg = '👩 🏆';
				} else if (this.$store.state.counter.humanScore < this.$store.state.counter.botScore) {
					msg = '🤖 🏆';
				} else {
					msg = "It's a 👩 🤖 tie!";
				}

				let feedback = new Feedback();

				feedback.show({
					title: msg,
					message: 'Try another set of images!',
					position: FeedbackPosition.Bottom, // iOS only
					messageColor: new Color('#6a5cff'),
					duration: 3000,
					backgroundColor: new Color('#4fffe8'),
					onTap: () => {
						feedback.hide();
					},
				});

				this.$store.dispatch('clearCount');
				this.$store.dispatch('clearScore');
			} else {
				this.queryMLKit(id);
			}
		},
github bradmartin / nativescript-snackbar / src / snackbar.android.ts View on Github external
private _setBackgroundColor(color) {
    // set background color
    if (color) {
      const sbView = this._snackbar.getView();
      sbView.setBackgroundColor(new Color(color).android);
    }
  }
github skhye05 / nativescript-bubble-navigation / src / bubble-navigation.android.ts View on Github external
for (let tab of tabs) {
            const bubbleToggle = new BubbleToggleView(this._context);
            const id = android.view.View.generateViewId();
            (bubbleToggle as any).setId(id);
            bubbleToggle.setBtDuration(300);

            let icon = utils.ad.resources.getDrawableId(tab.icon);
            bubbleToggle.setBtIcon(icon);
            bubbleToggle.setBtTitle(tab.title);

            if (tab.colorActive) {
                bubbleToggle.setBtColorActive(new Color(tab.colorActive).android);
            }

            if (tab.colorInactive) {
                bubbleToggle.setBtColorInactive(new Color(tab.colorInactive).android);
            }

            this.nativeView.addView(bubbleToggle);
        }

    }
    // Tabs Property
github sean-perkins / nativescript-animated-circle / src / animated-circle.android.ts View on Github external
if (this.barWidth) {
				this.android.setBarWidth(this.barWidth);
			} else {
				if (this.rimWidth) {
					// set rim width to bar width if no bar width provided
					this.android.setBarWidth(this.rimWidth);
				}
			}
            if (this.rimWidth) {
                this.android.setRimWidth(this.rimWidth);
            }
            if (this.barColor) {
                this.android.setBarColor([new Color(this.barColor).argb]);
            }
            if (this.fillColor) {
                this.android.setFillCircleColor(new Color(this.fillColor).argb);
            }

            this.android.setDirection(this.clockwise ? at.grabner.circleprogress.Direction.CW : at.grabner.circleprogress.Direction.CCW);
        }
    }
github NativeScript / NativeScript / tests / app / pages / navigation / pageB.ts View on Github external
export function createPage() {
    var page = new pages.Page();
    var stack = new stackModule.StackLayout();
    stack.style.backgroundColor = new color.Color("#FFFFFF00");

    var btn = new button.Button();
    btn.text = "Page C";
    btn.on(button.Button.tapEvent, function () {
        var nextPage = "tests/pages/navigation/pageC";
        frame.topmost().navigate(nextPage);
    });
    stack.addChild(btn);

    var btnActivity = new button.Button();
    btnActivity.text = "start activity";
    btnActivity.on(button.Button.tapEvent, function () {
        var newFrame = new frame.Frame();
        var newPage = "tests/pages/navigation/pageA-new-activity";
        newFrame.navigate(newPage);
    });
github Especializa / nativescript-ng-shadow / src / common / shadow.ts View on Github external
private static applyOnIOS(tnsView: any, data: IOSData) {
    const nativeView = tnsView.ios;
    const elevation = parseFloat(((data.elevation as number) - 0).toFixed(2));
    nativeView.layer.maskToBounds = false;
    nativeView.layer.shadowColor = new Color(data.shadowColor).ios.CGColor;
    nativeView.layer.shadowOffset =
      data.shadowOffset ?
      CGSizeMake(0, parseFloat(String(data.shadowOffset))) :
      CGSizeMake(0, 0.54 * elevation - 0.14);
    nativeView.layer.shadowOpacity =
      data.shadowOpacity ?
      parseFloat(String(data.shadowOpacity)) :
      0.006 * elevation + 0.25;
    nativeView.layer.shadowRadius =
      data.shadowRadius ?
      parseFloat(String(data.shadowRadius)) :
      0.66 * elevation - 0.5;
  }
github charsleysa / nativescript-mdc / src / components / snackBar / snackBar.ios.ts View on Github external
private _setBackgroundColor(color) {
        if (color) {
            this._snackbarManager.snackbarMessageViewBackgroundColor = new Color(color).ios;
        }
    }
github NativeScripting / course-exercise-files-nativescript-angular-pro / Chapter5 / rpstrackertnsng / app / core / models / domain / enums / item-priority.enum.ts View on Github external
export function getColor(priority: PriorityEnum): Color {
        switch (priority) {
            case PriorityEnum.Critical:
                return new Color('#820101');
            case PriorityEnum.High:
                return new Color('#b27100');
            case PriorityEnum.Medium:
                return new Color('#0c6d00');
            case PriorityEnum.Low:
                return new Color('#002b6d');
        }
    }
}
github hamdiwanis / nativescript-app-tour / src / app-tour.android.ts View on Github external
const targets: any[] = stops.map(stop => {
            this.currentStop = 0;

            return TapTarget.forView(stop.view.android, stop.title, stop.description|| this.defaults.description)
                .outerCircleColorInt(new Color(stop.outerCircleColor|| this.defaults.outerCircleColor).android)
                .outerCircleAlpha(float(stop.outerCircleOpacity|| this.defaults.outerCircleOpacity))
                .targetCircleColorInt(new Color(stop.innerCircleColor|| this.defaults.innerCircleColor).android)
                .titleTextSize(stop.titleTextSize|| this.defaults.titleTextSize)
                .titleTextColorInt(new Color(stop.titleTextColor|| this.defaults.titleTextColor).android)
                .descriptionTextSize(stop.descriptionTextSize|| this.defaults.descriptionTextSize)
                .descriptionTextColorInt(new Color(stop.descriptionTextColor|| this.defaults.descriptionTextColor).android)
                .cancelable(stop.dismissable)
                .drawShadow(true)
                .tintTarget(false)
                .targetRadius(stop.innerCircleRadius|| this.defaults.innerCircleRadius);
        });
github triniwiz / nativescript-star-ratings / src / star-ratings.android.ts View on Github external
set filledColor(color: string) {
    this._filledColor = color;
    if (this._stars) {
      const leftDrawable = this._stars.getDrawable(
        1
      ) as android.graphics.drawable.Drawable;
      const rightDrawable = this._stars.getDrawable(
        2
      ) as android.graphics.drawable.Drawable;
      leftDrawable.setColorFilter(
        new Color(color).android,
        android.graphics.PorterDuff.Mode.CLEAR
      );
      rightDrawable.setColorFilter(
        new Color(color).android,
        android.graphics.PorterDuff.Mode.SRC_ATOP
      );
    }
  }