The colors support transparency???
dianjuar opened this issue · comments
Hi I wonder if the gradient colors support transparency.
To be more specific, I need do a gradient from black to transparent...
The code is:
<GridLayout class="product-image">
<Image [src]="productActual.image" stretch="aspectFill"></Image>
<Gradient class="gadient-top" direction="to bottom" colors="#000000, #FFFFFF" verticalAlignment="top" > </Gradient>
</GridLayout>
I DID IT!!!! I HACK IT!!!!
Viewing the attribute colors
of <Gradient>
, I saw there is a compatibility with the CSS colors.
I test it with "red"
and rgb(255, 0, 0)
and the result was the same, so I use RGBA Colors
to get my transparency, I simple use rgba(0, 0, 0, 0)
to get a full transparent color.
<GridLayout class="product-image">
<Image [src]="productActual.image" stretch="aspectFill"></Image>
<Gradient class="gadient-top" direction="to bottom" colors="#000000, rgba(0, 0, 0, 0)" verticalAlignment="top" > </Gradient>
</GridLayout>
Maybe in your readme, in the usage section, you need to tell that your colors definitions are compatible with CSS Colors
@dianjuar Thats a really cool trick.
Hey @dianjuar, nice job!
It was mentioned in the readme that anything you can pass to NativeScript's new Color(...)
constructors would work, but I've now made it more clear.