Combined background color and image in shape - path

I want to set this style for an SVG <path>:
background-color: red;
background-image: url('myImage.png');
This picture has transparent pixels and I need background color to fill it.

What you would do in SVG is to define a <pattern> that contains a rect with the color you want and the image you want, and then use that as fill for the <path>.
See this example from the SVG testsuite.
'background-image' and 'background-color' don't apply to svg content unless it's handled by the CSS box model (so basically just the root svg element).

I'm reasonably sure you cannot have an image with a background colour in one path.
You can however replicate the effect by having two paths in the same position, with the image path on top of the solid colour path.

Related

Nested transparency in OpenSCAD output

Transparency in OpenSCAD output can be achieved by prepending % to elements, but this doesn't allow to put a transparent element in a surrounding element with a higher degree (e.g. expressed in percentage) of transparency and make it possible to see an (opaque) element in a transparent element inside a transparent element. How to do that?
the a-value of color([r,g,b,a]) can be used to control transparency, e.g.:
color([0.5,0.5,0,0.8]) cube(size=[10,10,10], center=true);
%cube(size=[20,20,20], center=true);
or with different colors:
color([0.5,0.5,0,0.8]) cube(size=[10,10,10], center=true);
color([0,0.5,0.5,0.3]) cube(size=[20,20,20], center=true);

Remove black border from TcolorButton

Is there anyway to remove the black border from a TColorbutton ? Delphi xe5, developing for iOSdelp
There are actually three black or gray borders.
First, add a custom stylebook to your app. The docwiki tells how to do this:
http://docwiki.embarcadero.com/RADStudio/XE5/en/Customizing_the_Design_of_a_FireMonkey_Application
Follow step #2 (Step 3 doesn't work for mobile applications.)
Open the style editor and locate ColorButtonStyle.
Expand the tree node and click on "background" in the structure.
In the object inspector locate Fill and expand that node.
Change the fill Kind to bkNone.
That removes the wide gray bordered, leaving two dark gray 1px borders.
Further down the list of properties just below Sides is Stroke.
Change it's Kind to bkNone. That removes the outer gray line.
Depending on your app you may need to also edit the color animations below the background rectangle. I did this by erasing (blanking out) the triggers since I was unable to delete the animations.
Next go the Fill component and set the stroke kind to bkNone. That removes the inner gray line.
You may also also want to set the Fill Margins to 0 so the color extends to the outside of the object. (i.e no padding now that the gray is not there.)
Gary

How to make navbar transparent

I have created a navbar at PureCSSMenu.com but the site doesn't offer a way to make the navbar transparent. Is it possible to tweak the code to make it transparent?
You can view the navbar below:
http://spectrum.x10.mx/navbar.html
At line 16 of your CSS, in rule ul.pureCssMenu, ul.pureCssMenu ul, change the background color:
background-color:rgba(255,255,255,0.5);
You now have #ffffff there, meaning the background is opaque white. RGBA notation includes an Alpha channel, in this example set to 0.5 for half-transparency. 1 is fully opaque, 0 is fully transparent.
The same applies to line 42 in the rule for the a elements inside, but I'd recommend deleting its background color completely - stacking semi-transparent colors is not really practical.

Colors applied via Imagemagick are off from what is expected

I'm trying to set the background of part of an image, to match the colors of other things in a web browser. Somehow the colorspace is different, and the colors don't match when using the same hex or rgb colors.
Example: I use this imagemagick command
convert frog.png -gravity North -background "#83c422" -extent 307x300 newfrog.png
to add a green (#83c422) rectangle to the bottom of an image.
Then I put it in a html page with the background given the same color value:
<html>
<body style="background-color: #83c422">
<img src="newfrog.png">
</body>
</html>
And I get this, where the background color of the page doesn't match the color added to the bottom of the image:
What do I need to do to get the colors to match? Is there some setting for imagemagick to do the colors in the more standard way? (note also that Gimp and various other things all say that the color given to the bottom of the image is not #83c422, but is #93cb2c)
Assuming you have a non-sRGB monitor profile, the problem is that CSS colors still aren't managed in Chrome. Safari has the same issue, AFAIK. Only Firefox (with gfx.color_management.mode = 1) and Opera get it right.

can logo.png in my header ignore my custom css stylesheet? (ruby on rails)

I just want the png to overlap my already built (bootstrap) header, so basically ignore it.
could I modify app/views/home/index.html.erb so that the png just sits independently of what the css does?
You can use css to position the png where you want it. In your custom stylesheet, try something like:
img#id-of-image {
position: absolute:
top: 5px;
left: 5px;
}
You can play with the top and left values to position it where you want.
If you need to nest it inside something, you need to put it within a container (ie. a div) and set the position of that container to "position: relative;". Then the top/left will be relative to the inside top corner of the container.

Resources