How to use the tns-core-modules/color/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 charsleysa / nativescript-mdc / src / components / core / material.ios.ts View on Github external
export function getRippleColor(color: string | Color): UIColor {
    if (color) {
        const temp = typeof color === 'string' ? new Color(color) : color;
        return new Color(temp.a !== 255 ? temp.a : 36, temp.r, temp.g, temp.b).ios; // default alpha is 0.14
    }
    return null;
}
github shirakaba / react-nativescript / sample / app / RNSTester / RNSTesterExampleList.tsx View on Github external
const styles = {
    listContainer: {
        flex: 1,
    },
    list: {
        backgroundColor: '#eeeeee',
    },
    sectionHeader: {
        backgroundColor: new Color('#eeeeee'),
        padding: 5,
        // fontWeight: '500',
        fontSize: 11,
    },
    row: {
        backgroundColor: new Color('white'),
        justifyContent: 'center' as 'center',
        paddingHorizontal: 15,
        paddingVertical: 8,
    },
    separator: {
        // height: StyleSheet.hairlineWidth,
        backgroundColor: '#bbbbbb',
        marginLeft: 15,
    },
    separatorHighlighted: {
        // height: StyleSheet.hairlineWidth,
        backgroundColor: 'rgb(217, 217, 217)',
    },
    sectionListContentContainer: {
        backgroundColor: 'white',
    },
github charsleysa / nativescript-mdc / src / components / core / android / utils.ts View on Github external
export function getEnabledColorStateList(color: number, variant: string) {
    const states = Array.create('[I', 2);
    // const SELECTED_PRESSED_STATE_SET = Array.create("int",1);
    // SELECTED_PRESSED_STATE_SET[0] =  state.enabled;
    states[0] = Array.create('int', 1);
    states[0][0] = -state.enabled;
    states[1] = android.util.StateSet.NOTHING;
    // states[1][0] = new java.lang.Integer(-state.enabled);
    // const states = [
    //     getSELECTED_PRESSED_STATE_SET(),
    //     []]
    // ;
    const colors = Array.create('int', 2);
    colors[0] = variant === 'text' || variant === 'outline' ? 0 : new Color(30, 0, 0, 0).android;
    colors[1] = color;
    return new android.content.res.ColorStateList(states, colors);
}
export function getFocusedColorStateList(color: number, variant: string) {
github NativeScript / nativescript-sdk-examples-ng / app / ng-ui-widgets-category / bottom-navigation / properties / properties.component.ts View on Github external
createContent(index: number) {
        const label = new Label();
        label.text = `${index === 0 ? "Home" : (index === 1 ? "Account" : "Search")}`;
        label.className = "h2 text-center";
        label.color = new Color("red");
        const stack = new StackLayout();
        stack.verticalAlignment = "middle";
        stack.addChild(label);

        return stack;
    }
    // << (hide)
github Akylas / nativescript-material-components / src / core / android / utils.ts View on Github external
export function getFocusedColorStateList(color: number, variant: string) {
    const states = Array.create('[I', 3);

    states[0] = Array.create('int', 1);
    states[0][0] = state.pressed;
    states[1] = Array.create('int', 2);
    states[1][0] = state.enabled;
    states[1][1] = state.focused;
    // states[2] = Array.create('int', 1);
    // states[2][0] = state.selected;
    states[2] = android.util.StateSet.NOTHING;
    const colors = Array.create('int', 4);
    colors[0] = color;
    colors[1] = color;
    colors[2] = color;
    colors[2] = new Color(255, 160, 160, 160).android;
    return new android.content.res.ColorStateList(states, colors);
}
github rhanb / nativescript-bottombar / src / bottombar-item / android / bottombar-item.ts View on Github external
createViewBadge(bottomBar: BottomNavigationViewType, context: any): Label {
        const textView = new Label();
        textView.text = this._badge ? this._badge : '';
        textView.textAlignment = textView.horizontalAlignment = 'center';
        textView.fontSize = 8;
        textView.color = new Color('white');
        textView.backgroundColor = this._badgeBackgroundColor
            ? this._badgeBackgroundColor
            : 'red';
        textView.borderRadius = '10';
        textView.width = 13;
        textView.height = 13;
        textView.marginLeft = 10;
        textView.marginTop = 5;
        textView._setupUI(context);
        textView.onLoaded();

        const itemView = (bottomBar.getChildAt(0) as any)
            .getChildAt(this.index);

        itemView.addView(textView.android);
github manijak / nativescript-photoviewer / demo-js / app / main-page.js View on Github external
function onLoaded(args) {
    const page = args.object;
    photoViewer = new photoViewerModule.PhotoViewer();
    mySpinner = page.getViewById("myspinner");

    if (pageModule.isIOS) {
        mySpinner.ios.activityIndicatorViewStyle = 0;
        mySpinner.ios.color = new colorModule.Color("#415677").ios;
    }
}
github sean-perkins / nativescript-healthcare-app / app / +dashboard / components / dashboard / dashboard.component.ts View on Github external
}).then(() => {
            grid.animate({
                backgroundColor: new Color('#fff'),
                duration: 0
            }).then(() => {
                this.routerExt.navigate(['/app/dashboard', widget.label]);
            });
        });
    }
github bradmartin / nativescript-lottie / demo / app / main-view-model.ts View on Github external
public setTheme = value => () => {
    const color = new Color(value);
    ANDROID_WAVE_KEYPATHS.forEach(keyPath => {
      this._lottieViewTwo.setColorValueDelegateForKeyPath(color, [...keyPath]);
    });
  };