How do I programmatically set the background color gradient on a Custom Title Bar?

To do this in code, you create a GradientDrawable. The only chance to set the angle and color is in the constructor. If you want to change the color or angle, just create a new GradientDrawable and set it as the background View layout = findViewById(R.id.mainlayout); GradientDrawable gd = new GradientDrawable( GradientDrawable.Orientation.TOP_BOTTOM, new int[] {0xFF616261,0xFF131313}); … Read more

Gradients in Internet Explorer 9

Looks like I’m a little late to the party, but here’s an example for some of the top browsers: /* IE10 */ background-image: -ms-linear-gradient(top, #444444 0%, #999999 100%); /* Mozilla Firefox */ background-image: -moz-linear-gradient(top, #444444 0%, #999999 100%); /* Opera */ background-image: -o-linear-gradient(top, #444444 0%, #999999 100%); /* Webkit (Safari/Chrome 10) */ background-image: -webkit-gradient(linear, left … Read more

Circular gradient in android

You can get a circular gradient using android:type=”radial”: <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <gradient android:type=”radial” android:gradientRadius=”250dp” android:startColor=”#E9E9E9″ android:endColor=”#D4D4D4″ /> </shape>

Gradient of n colors ranging from color 1 and color 2

colorRampPalette could be your friend here: colfunc <- colorRampPalette(c(“black”, “white”)) colfunc(10) # [1] “#000000” “#1C1C1C” “#383838” “#555555” “#717171” “#8D8D8D” “#AAAAAA” # [8] “#C6C6C6” “#E2E2E2” “#FFFFFF” And just to show it works: plot(rep(1,10),col=colfunc(10),pch=19,cex=3)

SVG gradient using CSS

Just use in the CSS whatever you would use in a fill attribute. Of course, this requires that you have defined the linear gradient somewhere in your SVG. Here is a complete example: rect { cursor: pointer; shape-rendering: crispEdges; fill: url(#MyGradient); } <svg width=”100″ height=”50″ version=”1.1″ xmlns=”http://www.w3.org/2000/svg”> <style type=”text/css”> rect{fill:url(#MyGradient)} </style> <defs> <linearGradient id=”MyGradient”> <stop … Read more

Get Slightly Lighter and Darker Color from UIColor

– (UIColor *)lighterColorForColor:(UIColor *)c { CGFloat r, g, b, a; if ([c getRed:&r green:&g blue:&b alpha:&a]) return [UIColor colorWithRed:MIN(r + 0.2, 1.0) green:MIN(g + 0.2, 1.0) blue:MIN(b + 0.2, 1.0) alpha:a]; return nil; } – (UIColor *)darkerColorForColor:(UIColor *)c { CGFloat r, g, b, a; if ([c getRed:&r green:&g blue:&b alpha:&a]) return [UIColor colorWithRed:MAX(r – 0.2, … Read more

Multi-gradient shapes

I don’t think you can do this in XML (at least not in Android), but I’ve found a good solution posted here that looks like it’d be a great help! ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { LinearGradient lg = new LinearGradient(0, 0, width, height, new int[]{Color.GREEN, Color.GREEN, … Read more

IE9 border-radius and background gradient bleeding

I have also been working with this problem. Another “solution” is to add a div around the item that has the gradient and rounded corners. Make that div the same height, width, and rounded corner values. Set the overflow to hidden. This is basically just a mask, but it works for me. HTML: <div class=”mask … Read more

Gradients on UIView and UILabels On iPhone [duplicate]

I realize this is an older thread, but for future reference: As of iPhone SDK 3.0, custom gradients can be implemented very easily, without subclassing or images, by using the new CAGradientLayer: UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)] autorelease]; CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = view.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)