How to use the color.Color.isValid function in color

To help you get started, we’ve selected a few 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 Akylas / nativescript-material-components / src / snackbar / snackbar.ios.ts View on Github external
const button = MDCSnackbarMessageAction.alloc().init();

        button.title = options.actionText;

        message.text = options.message;
        message.duration = options.hideDelay;
        message.action = button;
        message.completionHandler = (userInitiated: boolean) => {
            this._shown = false;
            resolve({
                action: SnackBarAction.DISMISS,
                reason: userInitiated ? DismissReasons.ACTION : DismissReasons.TIMEOUT
            });
        };

        if (options.textColor && Color.isValid(options.textColor)) {
            this._setTextColor(options.textColor);
        }

        if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
            message.buttonTextColor = new Color(options.actionTextColor).ios;
        }

        if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
            this._setBackgroundColor(options.backgroundColor);
        }

        this._snackbarManager.showMessage(message);
    }
github Akylas / nativescript-material-components / src / snackbar / snackbar.ios.ts View on Github external
this._snackbarManager.messageTextColor = null;
                this._snackbarManager.snackbarMessageViewBackgroundColor = null;

                const snackBarMessage = (this._message = MDCSnackbarMessage.new());

                snackBarMessage.text = message;
                snackBarMessage.duration = timeout;
                snackBarMessage.completionHandler = () => {
                    resolve({
                        action: 'Dismiss',
                        reason: DismissReasons.TIMEOUT
                    });
                };

                if (textColor && Color.isValid(textColor)) {
                    this._setTextColor(textColor);
                }

                if (backgroundColor && Color.isValid(backgroundColor)) {
                    this._setBackgroundColor(backgroundColor);
                }
            } catch (ex) {
                reject(ex);
            }
        });
    }
github Akylas / nativescript-material-components / src / snackbar / snackbar.ios.ts View on Github external
this._shown = false;
            resolve({
                action: SnackBarAction.DISMISS,
                reason: userInitiated ? DismissReasons.ACTION : DismissReasons.TIMEOUT
            });
        };

        if (options.textColor && Color.isValid(options.textColor)) {
            this._setTextColor(options.textColor);
        }

        if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
            message.buttonTextColor = new Color(options.actionTextColor).ios;
        }

        if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
            this._setBackgroundColor(options.backgroundColor);
        }

        this._snackbarManager.showMessage(message);
    }
github Akylas / nativescript-material-components / src / snackbar / snackbar.ios.ts View on Github external
message.text = options.message;
        message.duration = options.hideDelay;
        message.action = button;
        message.completionHandler = (userInitiated: boolean) => {
            this._shown = false;
            resolve({
                action: SnackBarAction.DISMISS,
                reason: userInitiated ? DismissReasons.ACTION : DismissReasons.TIMEOUT
            });
        };

        if (options.textColor && Color.isValid(options.textColor)) {
            this._setTextColor(options.textColor);
        }

        if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
            message.buttonTextColor = new Color(options.actionTextColor).ios;
        }

        if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
            this._setBackgroundColor(options.backgroundColor);
        }

        this._snackbarManager.showMessage(message);
    }
github bradmartin / nativescript-twitterbang / twitterbang.android.ts View on Github external
opts.colors.forEach(c => {
                if (Color.isValid(c)) {
                    let parsedColor = new Color(c).android;
                    androidColorArray.push(parsedColor);
                }

            })
            mSmallBang.setColors(androidColorArray);
github Akylas / nativescript-material-components / src / snackbar / snackbar.ios.ts View on Github external
const snackBarMessage = (this._message = MDCSnackbarMessage.new());

                snackBarMessage.text = message;
                snackBarMessage.duration = timeout;
                snackBarMessage.completionHandler = () => {
                    resolve({
                        action: 'Dismiss',
                        reason: DismissReasons.TIMEOUT
                    });
                };

                if (textColor && Color.isValid(textColor)) {
                    this._setTextColor(textColor);
                }

                if (backgroundColor && Color.isValid(backgroundColor)) {
                    this._setBackgroundColor(backgroundColor);
                }
            } catch (ex) {
                reject(ex);
            }
        });
    }