css text gradient

You can do it using CSS but it will only work in webkit browsers (Chrome and Safari): p { background: linear-gradient(red, blue); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; } <p>blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah … Read more

Can I apply a gradient along an SVG path?

Mike Bostock figured out a way, though it’s not easy: https://bl.ocks.org/mbostock/4163057 Basically, this technique uses getPointAtLength to slice the stroke into many short strokes, specify interpolated color stops for each, and then apply a gradient to each short stroke between those stops. Good luck if you’re up to the challenge 😉 Edit (July 3rd, 2019): … Read more

Change JButton gradient color, but only for one button, not all

You can override the paintComponent method of the JButton instance and paint its Graphics object with one of the following classes that implement the Paint interface: GradientPaint. LinearGradientPaint MultipleGradientPaint RadialGradientPaint import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public final class JGradientButtonDemo { … Read more

SVG angular gradient

…10 years later… CSS now supports conical gradients, although browser support is mixed at the time of writing this. You could apply a <clipPath /> to a <foreignObject /> whose contents use a CSS conical gradient to achieve the desired effect. https://codepen.io/eastonium/pen/abOpdEm

svg multiple color on circle stroke

This approach won’t work. SVG doesn’t have conical gradients. To simulate the effect, you would have to fake it with a large number of small line segments. Or some similar technique. Update: Here is an example. I approximate the 360deg of hue with six paths. Each path contains an arc which covers 60deg of the … Read more