Gtk3 Transparent Container - css

I'm working on a Gtk3 application. Therefore I designed the window on Ubuntu with Glade 3.16.1.
I have a GtkWindow layout with a vertical seperating GtkPaned. Loading a CSS file I give the window a background image like this:
GtkWindow#window {
background-image: url("Glade Prototype/background.png");
}
But It seems like the layout component is drawn on it with a solid color and so the background image is only partially visible. You can see it
here
My first try was setting the background color of the layout transparent, but it didn't changed anything (Any other color works):
GtkPaned#mainLayout {
background-color: transparent;
/* OR: background-color: rgba(0, 0, 0, 0.0) */
/* OR: background-image: none */
}
Thanks for help,
Greetings Thomas
PS: Does anyone have a Glade version for Windows supporting Gtk3 (+CSS)? I only found Glade 3.8 (CSS supporting versions are e.g. 3.16 / 3.18) on their website.
Edit: Here a better example for this problem:
GtkWindow#window {
background-color: #00FF00;
}
GtkPaned#mainLayout {
background-color: rgba(255, 0, 0, 0.5)
}
-> Image with Alpha 50% / 0.5
You can see that it looks like a mix of red and white color. But i want that white color to disappear.
Edit2:
I've also tried overriding the draw function and drawing a transparent rectangle with Cairo -> No success. My code:
G_MODULE_EXPORT gboolean drawMainContainer(GtkWidget *widget, cairo_t *cr, gpointer data) {
guint width, height;
GdkRGBA color;
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
cairo_rectangle (cr, 0, 0, width, height);
gtk_style_context_get_color (gtk_widget_get_style_context (widget),
0,
&color);
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_fill (cr);
return FALSE;
}

Related

Setting a elements background to transparent makes it white

I am trying to set the color for a header on a wordpress website to transparent, so that the logo and menu icon show over the website's other elements and do not have their own background.
My issue is the following. The CSS that sets the header color is the following, in my app.css file:
header.dark-header {
background-color:#252627;
border-color:transparent;
border-bottom:0;
}
If I set that to transparent, the background actually turns white and is not transparent.
Images explaining the issue: https://imgur.com/a/XJta1p1
Website demo: http://security4.forebet.ro
I have no idea what to do or why this is happening. Anybody?
Setting background-color: transparent; should do the trick.
So like this:
header.dark-header {
background-color: transparent;
border-color:transparent;
border-bottom:0;
}
transparent is the default value for background-color, so if the element's background turns white when you use it, the default is probably being overridden by a parent element where background-color has an explicitly set value. Short of digging through your stylesheet and changing this (probably the best solution), you can use the CSS rgba() function to explicitly set the header's background opacity to zero like this:
header.dark-header {
background-color: rgba(0, 0, 0, 0);
border-color: rgba(0, 0, 0, 0);
border-bottom:0;
}
Although be advised that browser support for the rgba() function is still a little spotty.

Fancybox 3 CSS for Thumbnail Sidebar

How can I change the color of the thumbnail side bar from white to black?
This can be done using CSS, for example:
.fancybox-thumbs {
background: rgba(0, 0, 0, 0.3);
}
Demo - https://codepen.io/anon/pen/POgEMb

Using CSS3, solid black background that is 95% transparent?

Using CSS3, what RGB-like value should replace VALUE below in order to achieve a solid black background that is 95% transparent?
div { background: VALUE }
Thanks Folks!!!
RGBa (a for alpha)
div { background: rgba(0, 0, 0, .05)};
You can use an RGBA notation.
R for red, G for Green, B for Blue and the A for aplha (percentage of transparency, as you've asked).
So the best answer is :
div {
background : rgba(0, 0, 0, .95);
}
And don't worry, it's supported by all the major browsers (even IE since IE 9) : http://caniuse.com/css3-colors
RGBa, i think:
div {
background:rgba(0, 0, 0, 0.95);
}
Folks i took a challenge test online and the following is the answers they provided to my question above:
div { background:rgba(0, 0, 0, 0.05); }
To check, I ran a test on my system and #Blingue is definitely correct.
Use div {background:rgba(0,0,0,0.05)}

How to change the opacity of the selected text?

I have almost invisible text on the webpage with opacity: 0.1;
I want it to become visible when selected.
However, the selection is also almost invisible.
Unfortunately, ::selection doesn't change the opacity.
You won't be able to use the opacity property with ::selection. It was never one of the allowed properties, and even if it were implemented, it wouldn't make sense as you're not modifying the opacity of the element itself anyway.
You can use rgba() colors with the text and background rather than opacity on the entire element instead. It's not the ideal workaround, but it works at least for colors:
body {
color: rgba(0, 0, 0, 0.1);
}
::-moz-selection {
color: rgba(0, 0, 0, 1);
}
::selection {
color: rgba(0, 0, 0, 1);
}
<p>Almost invisible text that turns opaque on selection.
Instead of using opacity, just set the alpha in the rgba color like so...
::selection {
background: rgba(255, 255, 0, 0.5)
}

flex css transparency

I'm trying to make the background of all tabs from a TabNavigator completely transparent (via CSS), but somehow I can't get this done correctly.
This is what I've got so far:
TabNavigator
{
tabStyleName: "tabNavTab";
fillAlphas: 0, 0, 0, 0;
backgroundAlpha: 0;
focusAlpha: 0;
borderStyle: none;
}
.tabNavTab
{
fillAlphas: 0, 0, 0, 0;
backgroundAlpha: 0;
borderStyle: none;
focusAlpha: 0;
}
But the tabs still have borders and the inactive tabs still have a tiny gradient from white to transparent.
What am I missing?
edit:
I got it. I have to set the upSkin, downSkin... properties, too!
I always recommend the use of the style explorer:
http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html
Helps me with almost all of my CSS issues.

Resources