Is it possible to set transparency in gradient which is set in the XML file?
2 Answers
Say you have a gradient with 2 colors:
StartColor#111111EndColor#333333
Adding transparency is as simple as adding 2 HEX digits to the beginning of each color
SO:
If you want the StartColor (for example) to be 100% opaque:
- change its value to #FF111111
If you want the EndColor (for example) to be 100% transparent:
- change its value to #00333333
You can of course use values between 00 and FF for transparency if you don't want the extreme values.
The values between HEX 00 and FF are values between 0 and 255 in normal numbers:
To transform from [0,255] to [00,FF]:
- Open calculator in windows and change mode to scientific
There are options like : Dec, Hex, Oct ...
Choose Dec and type the number between 0 and 255
- Choose Hex and the number will become in hex between 00 and FF
3 Comments
sandalone
Where can I find the values between 00 and FF? Let's say I want 55% transparency.
sandalone
I think I found the link en.wikipedia.org/wiki/Web_colors#HTML_color_names which lead me to conclusio. HEX has 16 values (1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) where 8 is 50%, etc. This way I can set transparency up t0 6.25% precision (100 / 16). Is there a more precise way? Maybe some online tool?
Sherif elKhatib
open calculator in windows:
View -> Scientific Now enter a number between 0 and 255 (0 is 00 and 255 is FF) Choose Hex and you will get the value