Questions tagged [gradient]

Specifies a range of position-dependent colors, usually used to fill a region.

Specifies a range of position-dependent colors, usually used to fill a region.

enter image description here

4271 questions
38
votes
9 answers

Gradient that stops at a particular height and continues further with a solid color

I want to have a gradient in HTML/CSS. Assume some DIV is always more than 400px tall. I want to add the gradient so that it is #FFFFFF at the top and #EEEEEE at 300px. So the first 300px (height-wise) is a nice 'white to grey' gradient. After…
user529141
38
votes
1 answer

How to draw a smooth/dithered gradient on a canvas in Android

Several answers mention to use GradientDrawable.setDither(true) to draw smooth gradients in Android. That has no effect in my code. Any idea what I have to change to get a well looking gradient in my live wallpaper? GradientDrawable gradient = new…
André
  • 2,313
  • 2
  • 25
  • 29
36
votes
3 answers

Applying a Gradient to CAShapeLayer

Does anyone have any experience in applying a Gradient to a CAShapeLayer? CAShapeLayer is a fantastic layer class, but it appears to only support solid fill coloring, whereas I'd like it to have a gradient fill (actually an animatable gradient at…
36
votes
11 answers

How do I add a gradient to the text of a UILabel, but not the background?

hey, I want to be able to have a gradient fill on the text in a UILabel I know about CGGradient but i dont know how i would use it on a UILabel's text i found this on google but i cant manage to get it to…
DotSlashSlash
  • 5,143
  • 5
  • 30
  • 32
35
votes
2 answers

White to transparent gradient with background image

I need to apply a white to transparent gradient which covers about a 1/4 of the top of the page and a background image visible for the rest of the page. Im looking to achieve a seamless blend from a gradient to a textured image and to do this in…
Craig
  • 773
  • 2
  • 7
  • 10
34
votes
8 answers

SVG angular gradient

Is there a way to do an 'angular gradient' in SVG? (I don't know the official term -- it's the kind of gradient you see in color-pickers, where it varies by angle.) SVG seems to support only linear and radial gradients, but I'm thinking there might…
Ken
  • 1,261
  • 2
  • 9
  • 7
33
votes
3 answers

Can you create gradients that fade to opacity using CSS or JavaScript?

WebKit has introduced the ability to create CSS gradients. For example, with the following code: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#000)); However, is it possible to have an opacity gradient using CSS? I want the…
木川 炎星
  • 3,893
  • 13
  • 42
  • 51
33
votes
5 answers

Generating gradients programmatically?

Given 2 rgb colors and a rectangular area, I'd like to generate a basic linear gradient between the colors. I've done a quick search and the only thing I've been able to find is this blog entry, but the example code seems to be missing, or at least…
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146
33
votes
3 answers

SVG: why does external css override inline style for text?

I'm playing with using an SVG gradientFill as a way to visually 'truncate' long text strings in a d3.js chart. It seems that an external css style for fill will override the inline gradient fill style in the SVG... is that always the case? How can…
rolfsf
  • 1,853
  • 3
  • 24
  • 34
30
votes
11 answers

How to set status bar background as gradient color or a drawable in Android?

I want to set status bar background as gradient theme also status bar and action bar color should same gradient drawable, as per documentation we can set color to status bar in API level 21 and above by using
Sushant Gosavi
  • 3,647
  • 3
  • 35
  • 55
30
votes
3 answers

Imageview set color filter to gradient

I have a white image that I'd like to color with a gradient. Instead of generating a bunch of images each colored with a specific gradient, I'd like to do this in code (not xml). To change an image's color, I use…
Malfunction
  • 1,324
  • 4
  • 15
  • 25
30
votes
5 answers

How to make a UIView have an effect of transparent gradient?

I want to make a UIView have an effect of transparent gradient from the middle to the left and right. Like in this example: The word 籍 has the desired effect. This view is achieved by the class MarqueeLabel. I examined the source code, it is likely…
Desgard_Duan
  • 659
  • 1
  • 6
  • 12
30
votes
5 answers

Calculating gradient with NumPy

I really can not understand what numpy.gradient function does and how to use it for computation of multivariable function gradient. For example, I have such a function: def func(q, chi, delta): return q * chi * delta I need to compute it's…
Mikhail Elizarev
  • 965
  • 3
  • 10
  • 22
29
votes
3 answers

Can you overlay a transparent css3 gradient over a background image?

I'm trying to put a css3 gradient over the top of a background image. Using the code below puts a background image on top of my gradient, but i'm trying to do it the other way around, so the gradient acts as a mask on…
Pineapple Sunset
  • 317
  • 1
  • 4
  • 8
29
votes
2 answers

2D grid data visualization in Python

I need to visualize some data. It's basic 2D grid, where each cell have float value. I know how to e.g. assign color to value and paint grid in OpenCV. But the point here is that there are so many values so it's nearly impossible to do that. I am…
Mateusz Korycinski
  • 1,037
  • 3
  • 10
  • 24