Why white transparent color becomes grey?











up vote
6
down vote

favorite












I'm trying to make a figure which use transparency in tikz. The figure consists in two overlapping rectangles. One which fading to the right and the other to the left. The rectangle fading to the right is pretty easy to make:



fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);


However, I cannot make the other rectangle as I want. I want it to be white on the left and blue on the right. It must also be transparent (having a alpha value equal to 70%). I tried multiple things such as using tikzfading or defining an opacity level in the fill command. Here is a [mcve]:



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


which gives the following result:
enter image description here



While the leftmost figure has the second rectangle transparent on the left, it does not apply a white filter on the first rectangle. On the second figure this rectangle does not have any transparency property. Finally the rectangle of rightmost figure does have transparency but the white which has an opacity level equal to 0.7 turn to be grey. What I want to achieve is to draw a rectangle which has the color 255,255,255 in RGB and an alpha value around 180 on the left side. Is that possible ?










share|improve this question







New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Welcome to TeX.SE! I guess the issue is that fill and shade are different, see here.
    – marmot
    1 hour ago















up vote
6
down vote

favorite












I'm trying to make a figure which use transparency in tikz. The figure consists in two overlapping rectangles. One which fading to the right and the other to the left. The rectangle fading to the right is pretty easy to make:



fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);


However, I cannot make the other rectangle as I want. I want it to be white on the left and blue on the right. It must also be transparent (having a alpha value equal to 70%). I tried multiple things such as using tikzfading or defining an opacity level in the fill command. Here is a [mcve]:



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


which gives the following result:
enter image description here



While the leftmost figure has the second rectangle transparent on the left, it does not apply a white filter on the first rectangle. On the second figure this rectangle does not have any transparency property. Finally the rectangle of rightmost figure does have transparency but the white which has an opacity level equal to 0.7 turn to be grey. What I want to achieve is to draw a rectangle which has the color 255,255,255 in RGB and an alpha value around 180 on the left side. Is that possible ?










share|improve this question







New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Welcome to TeX.SE! I guess the issue is that fill and shade are different, see here.
    – marmot
    1 hour ago













up vote
6
down vote

favorite









up vote
6
down vote

favorite











I'm trying to make a figure which use transparency in tikz. The figure consists in two overlapping rectangles. One which fading to the right and the other to the left. The rectangle fading to the right is pretty easy to make:



fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);


However, I cannot make the other rectangle as I want. I want it to be white on the left and blue on the right. It must also be transparent (having a alpha value equal to 70%). I tried multiple things such as using tikzfading or defining an opacity level in the fill command. Here is a [mcve]:



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


which gives the following result:
enter image description here



While the leftmost figure has the second rectangle transparent on the left, it does not apply a white filter on the first rectangle. On the second figure this rectangle does not have any transparency property. Finally the rectangle of rightmost figure does have transparency but the white which has an opacity level equal to 0.7 turn to be grey. What I want to achieve is to draw a rectangle which has the color 255,255,255 in RGB and an alpha value around 180 on the left side. Is that possible ?










share|improve this question







New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm trying to make a figure which use transparency in tikz. The figure consists in two overlapping rectangles. One which fading to the right and the other to the left. The rectangle fading to the right is pretty easy to make:



fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);


However, I cannot make the other rectangle as I want. I want it to be white on the left and blue on the right. It must also be transparent (having a alpha value equal to 70%). I tried multiple things such as using tikzfading or defining an opacity level in the fill command. Here is a [mcve]:



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
fill[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
fill[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


which gives the following result:
enter image description here



While the leftmost figure has the second rectangle transparent on the left, it does not apply a white filter on the first rectangle. On the second figure this rectangle does not have any transparency property. Finally the rectangle of rightmost figure does have transparency but the white which has an opacity level equal to 0.7 turn to be grey. What I want to achieve is to draw a rectangle which has the color 255,255,255 in RGB and an alpha value around 180 on the left side. Is that possible ?







tikz-pgf color transparency






share|improve this question







New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









Missu

1333




1333




New contributor




Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Missu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    Welcome to TeX.SE! I guess the issue is that fill and shade are different, see here.
    – marmot
    1 hour ago














  • 1




    Welcome to TeX.SE! I guess the issue is that fill and shade are different, see here.
    – marmot
    1 hour ago








1




1




Welcome to TeX.SE! I guess the issue is that fill and shade are different, see here.
– marmot
1 hour ago




Welcome to TeX.SE! I guess the issue is that fill and shade are different, see here.
– marmot
1 hour ago










1 Answer
1






active

oldest

votes

















up vote
5
down vote



accepted










If you replace fill by shade in the middle and right figures, you get



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


enter image description here



Is that what you want?






share|improve this answer





















  • The rightmost figure is exactly what I was aiming for
    – Missu
    1 hour ago










  • @Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
    – marmot
    55 mins ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Missu is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464667%2fwhy-white-transparent-color-becomes-grey%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
5
down vote



accepted










If you replace fill by shade in the middle and right figures, you get



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


enter image description here



Is that what you want?






share|improve this answer





















  • The rightmost figure is exactly what I was aiming for
    – Missu
    1 hour ago










  • @Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
    – marmot
    55 mins ago















up vote
5
down vote



accepted










If you replace fill by shade in the middle and right figures, you get



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


enter image description here



Is that what you want?






share|improve this answer





















  • The rightmost figure is exactly what I was aiming for
    – Missu
    1 hour ago










  • @Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
    – marmot
    55 mins ago













up vote
5
down vote



accepted







up vote
5
down vote



accepted






If you replace fill by shade in the middle and right figures, you get



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


enter image description here



Is that what you want?






share|improve this answer












If you replace fill by shade in the middle and right figures, you get



documentclass{standalone}

usepackage{tikz}
usetikzlibrary{fadings}

begin{document}
%leftmost figure
begin{tikzpicture}
tikzfading[name=fade right,
left color=transparent!0,
right color=transparent!100]
tikzfading[name=fade left,
right color=transparent!0,
left color=transparent!70!white]

fill[blue, path fading=fade right] (0, 1) rectangle (3, 3);
fill[blue, path fading=fade left] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%middle figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white!70!transparent, right color=blue] (0, 0) rectangle (2, 2.5);
end{tikzpicture}

%rightmost figure
begin{tikzpicture}
shade[shading=axis, left color=blue, right color=white] (0, 1) rectangle (3, 3);
shade[shading=axis, left color=white, right color=blue, opacity=.7] (0, 0) rectangle (2, 2.5);
end{tikzpicture}
end{document}


enter image description here



Is that what you want?







share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









marmot

82.9k493177




82.9k493177












  • The rightmost figure is exactly what I was aiming for
    – Missu
    1 hour ago










  • @Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
    – marmot
    55 mins ago


















  • The rightmost figure is exactly what I was aiming for
    – Missu
    1 hour ago










  • @Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
    – marmot
    55 mins ago
















The rightmost figure is exactly what I was aiming for
– Missu
1 hour ago




The rightmost figure is exactly what I was aiming for
– Missu
1 hour ago












@Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
– marmot
55 mins ago




@Missu Glad to hear! (Yes, this is a bit confusing since if you do not say fill, but just say path TikZ will "guess" that you mean shade, but if you say fill, it will fill in addition to shading. And unfortunately filling and shading an area are sometimes used interchangedly, so we could blame this on the language. ;-)
– marmot
55 mins ago










Missu is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Missu is a new contributor. Be nice, and check out our Code of Conduct.













Missu is a new contributor. Be nice, and check out our Code of Conduct.












Missu is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464667%2fwhy-white-transparent-color-becomes-grey%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

How to ignore python UserWarning in pytest?

Alexandru Averescu