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
29
votes
5 answers

Changing gradient background colors on Android at runtime

I'm experimenting with Drawable backgrounds and have had no problems so far. I'm now trying to change the gradient background color at runtime. Unfortunately, there's no API to change it at runtime, it seems. Not even by trying to mutate() the…
Phenome
  • 894
  • 1
  • 7
  • 12
29
votes
2 answers

How can I refer to an internal gradient definition inside an SVG sprite symbol?

SUMMARY: An SVG sprite contains five icon blocks, one of which references its own gradient definition by ID. It is no longer able to find this gradient and render properly. JSFIDDLE: http://jsfiddle.net/Qtq24/1/ I am switching some…
Matt Morrison
  • 1,540
  • 1
  • 14
  • 19
29
votes
3 answers

svg multiple color on circle stroke

I want to create a rainbow circle, like the picture below: How can I draw the curved and multiple color stop gradient? Here's my current code:
user2678106
29
votes
4 answers

Which color gradient is used to color mandelbrot in wikipedia?

At Wikipedia's Mandelbrot set page there are really beautiful generated images of the Mandelbrot set. I also just implemented my own Mandelbrot algorithm. Given n is the number of iterations used to calculate each pixel, I color them pretty simple…
q9f
  • 11,293
  • 8
  • 57
  • 96
28
votes
2 answers

Using derivatives as functions in CppAD

I am trying to modify the example here: # include namespace { // --------------------------------------------------------- // define the template function JacobianCases in empty namespace template bool…
user650261
  • 2,115
  • 5
  • 24
  • 47
28
votes
3 answers

SVG Line with Gradient Stroke Won't Display if vertical or horizontal

I'm attempting to replicate an
with SVG. Now, making a straight line with SVG works perfectly, but the second I stroke it with a gradient it will no longer display in a straight line. The following code works, but take note, y1 and y2 must be 1…
foxandsticks
  • 349
  • 3
  • 9
28
votes
8 answers

How to draw a gradient line (fading in/out) with Core Graphics/iPhone?

I know how to draw a simple line: CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); And I know how to do a gradient rectangle,…
Walchy
  • 1,150
  • 3
  • 11
  • 18
27
votes
4 answers

Pure CSS3 text color gradient - Is it possible?

Is there a way to create a cross-browser, pure CSS3 text color gradient? So, no png's. No 'webkit' only. EDIT: To be more precise: It's CSS3 only, and it's for text, not box gradients. EDIT: I found this solution, but it's only for webkit.
Kriem
  • 8,666
  • 16
  • 72
  • 120
27
votes
6 answers

how to make a gradient border of UIView?

I want to make a gradient border of view like the following picture: but I don't know how do it exactly , i.e. what the gradient color I should use to do it? how to set my view to show a border like the image? I'm using the following code to get…
remykits
  • 1,735
  • 4
  • 18
  • 20
26
votes
1 answer

My css gradient doesn't stretch, it repeats

body{ padding:0; margin:0; font:normal 12px/16px Arial, Helvetica, sans-serif; color:#383634; background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0.18, rgb(74,12,107)), color-stop(0.87, rgb(102,153,102)) ); background:…
Mike
  • 261
  • 1
  • 3
  • 3
26
votes
4 answers

Calculate color HEX having 2 colors and percent/position

Is it possible to calculate a color in a middle of a gradient? var color1 = 'FF0000'; var color2 = '00FF00'; // 50% between the two colors, should return '808000' var middle = gradient(color1, color2, 0.5); I only have two hex strings, and I want…
Kalamar Obliwy
  • 861
  • 2
  • 8
  • 13
26
votes
3 answers

Transparent (alpha) gradient with Core Graphic iPhone

anyone knows how to programmatically create a transparent gradient (alpha gradient), over an image with Core Graphic? I need it both for display an image and save it. An example of what I want to obtain:
Pablosproject
  • 1,374
  • 3
  • 13
  • 33
25
votes
4 answers

How do I combine CSS "text-shadow" and "background-image: -webkit-gradient"

I am trying to achieve a gradient + text shadow effect in Chrome/Safari using CSS text-shadow and a combination of text-shadow and background-image: -webkit-gradient, see example blw. I can only make one of the effects apply(if I add the shadow the…
mac
  • 9,885
  • 4
  • 36
  • 51
25
votes
1 answer

How can I do programmatically gradient border color UIButton with Swift

How can I design programmatically UIButton like this gradient border color? ] Thanks for help
m.akyol
  • 283
  • 1
  • 3
  • 7
24
votes
7 answers

How do you make a gradient background in css?

Is there any way to create a gradient background using nothing but CSS? You can see an example of what I want to achieve on this website.
user1179295
  • 706
  • 3
  • 10
  • 21