MaterialShowcaseView icon indicating copy to clipboard operation
MaterialShowcaseView copied to clipboard

Custom mask color too transparent

Open nolawnchairs opened this issue 8 years ago • 3 comments

I want to set the color of the mask to a different color, but when I do, the mask is barely visible and the text is not legible being set against the underlying content (I'm using a dark theme for my app).

Is there a way to set the alpha transparency of the mask?

nolawnchairs avatar Dec 06 '16 09:12 nolawnchairs

 private MaterialShowcaseView getSequence(View view, int title, int desc, String dismiss, int maskColor, int maskAlpha) {
        maskColor = addAlphaToColor(maskColor,` maskAlpha, getActivity());
        return new MaterialShowcaseView.Builder(getActivity())
                .setTarget(view)
                .setTitleText(title)
                .setContentText(desc)
                .setDismissText(dismiss)
                .setFadeDuration(150)
                .setDelay(0)
                .setMaskColour(maskColor)
                .setContentTextColor(Color.WHITE)
                .build();
    }
    private int addAlphaToColor(int color, int alpha) {
        int red = Color.red(color);
        int green = Color.green(color);
        int blue = Color.blue(color);
        return Color.argb(alpha, red, green, blue);
    }
    private int addAlphaToColor(int colorId, int alpha, Context context) {
        return addAlphaToColor(ContextCompat.getColor(context, colorId), alpha);
    }

buutqn avatar Jul 25 '17 10:07 buutqn

@mweiczorek I used this code to add alpha to a custom color: .setMaskColour((ContextCompat.getColor(this, R.color.accent_color) & 0x00FFFFFF) | 0xdd000000)

Dona278 avatar Jan 30 '18 16:01 Dona278

.setMaskColor(Color.parseColor("#AARRGGBB")); // e.g. #d9000000 transparent black

Transparency is controlled by the alpha channel (AA in #AARRGGBB). Maximal value (255 dec, FF hex) means fully opaque. Minimum value (0 dec, 00 hex) means fully transparent. Values in between are semi-transparent, i.e. the color is mixed with the background color

gvortel avatar Jul 19 '18 11:07 gvortel