gradient

Get Slightly Lighter and Darker Color from UIColor

主宰稳场 提交于 2019-11-28 02:35:26
I was looking to be able to turn any UIColor into a gradient. The way I am intending to do this is by using Core Graphics to draw a gradient. What I am trying to do is to get a color, lets say: [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]; and get a UIColor which is a few shades darker and a few shades lighter. Does anyone know how to do this? Thank you. - (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; }

How to render a radial gradient onto a new UIImage on an iphone

允我心安 提交于 2019-11-28 02:12:32
问题 Just wondering how to render a radial gradient (point > circle) onto a new UIImage (iphone). I saw the following: http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_shadings/dq_shadings.html And it made me think i need to use CGShadingRef or CGGradientRef, and use UIImage's 'imageWithCGImage' constructor to go from the CG* to a UIImage... but i can't figure out how. Any suggestions greatly appreciated! 回答1: You should read about Graphics

Gradient over Instagram SVG of FontAwesome 5

妖精的绣舞 提交于 2019-11-28 02:04:55
After upgrading to FontAwesome 5, I'm not able to color the svgs of FontAwesome. This is my example: ⠀⠀⠀⠀⠀ https://codepen.io/shadrix/pen/GygdZr Should be awesome if it worked like here: ⠀⠀⠀⠀⠀ https://codepen.io/immad-hamid/pen/jVNvQO (Note: he used FontAwesome 4). Icons are no longer referenced as glyphs from a font, but injected as inline SVG. The content color of the icon is defined as fill="currentColor" . The technique with setting the background and using -webkit-background-clip no longer works. Instead you can set the color property directly. Unfortunately, that is where you get into a

Python Imaging Library (PIL) Drawing--Rounded rectangle with gradient

↘锁芯ラ 提交于 2019-11-28 00:31:27
问题 I am trying to use PIL to draw a rectangle with rounded corners and a gradient fill for the color. I found a cool web site ( http://web.archive.org/web/20130306020911/http://nadiana.com/pil-tutorial-basic-advanced-drawing#Drawing_Rounded_Corners_Rectangle ) that shows how to draw a solid-color rounded rectangle and I am happy with this, but I want to be able to draw one that starts light red at the top and goes to dark red at the bottom. My initial thought was to use the code in the website

create an arrow with gradient color

元气小坏坏 提交于 2019-11-28 00:18:36
how can I create an arrow or segment with gradient color using R? Try this, library(grid) png("mask.png") grid.polygon(c(-0.06, 0.06, 0.06, 0.15, 0, -0.15, -0.06), c(-5, -5, 2.5, 2, 5, 2, 2.5), gp=gpar(fill="black"), def="native", vp=viewport(xs=c(-0.15, 0.15), ys=c(-5, 5))) dev.off() library(png) m <- readPNG("mask.png", native=FALSE) mask <- matrix(rgb(m[,,1],m[,,2],m[,,3]), nrow=nrow(m)) rmat <- matrix(rgb(colorRamp(c("blue","white","red"))(seq(0,1,length=nrow(m))), maxColorValue=255), nrow=nrow(m), ncol=ncol(m)) rmat[mask == "#FFFFFF"] <- NA grid.newpage() grid.raster(rmat) Edit : you can

Is it possible to make a gradient border?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 23:38:06
问题 As the title states, is it possible to make a gradient border in CSS3 and if so how? I know that you can make gradient backgrounds and there are many generators for that, but I am yet to find one that creates the code for a gradient border. 回答1: 1. Well.. this is no fancy css3 but heres one possible solution: I made this example for something else before and i just changed the background url of #childWrap http://jsfiddle.net/qD4zd/1/ ( note that the gradient isnt very flexible as it is done

Gradient color in a treemap for D3

隐身守侯 提交于 2019-11-27 22:49:59
问题 First of all this is different from the previous question asked in the posts, for what i am trying to achieve is a gradient for the entire treemap in d3, like what we have in google treemaps. I am trying to implement http://bost.ocks.org/mike/treemap/ and working on the same, but in d3 i was trying to have a color gradient in it. Currently I am doing this by color = d3.scale.category20c() and .style("fill", function(d) { return color(d.name)}) on my svg element. But i want to have a gradiant

background gradients in IE7 with CSS

佐手、 提交于 2019-11-27 22:20:46
问题 I am using the following bit of CSS to create a linear background gradient. It seems to work just fine in IE8/9, FF, Safari and chrome but not in IE7. IE7 shows a solid (green) background. Here is my code .menu_body a { display:block; color:#006699; background: #008800; /* Mozilla: */ background: -moz-linear-gradient(top, #0b71a4, #025f8e); /* Chrome, Safari:*/ background: -webkit-gradient(linear, left top, left bottom, from(#0b71a4), to(#025f8e)); /* MSIE */ filter: progid:DXImageTransform

css text gradient

我是研究僧i 提交于 2019-11-27 21:30:24
I've had alittle look around and can't find anything about this. If i have a paragraph of text, is there a way, maybe with CSS3 to gradually change the colour of the text as it goes down to the page? instead of the way that gradient does it, because that only does it on the word not the whole paragraph of text. So i want some text to start off white and then fade into black as it gets to the end of the paragraph. I'm really not sure it can be done... Maybe there is a java script that can do it. Thanks. You can do it using CSS but it will only work in webkit browsers (Chrome and Safari): http:/

SVG “fill: url(#…)” behaving strangely in Firefox

那年仲夏 提交于 2019-11-27 20:57:07
问题 I have the following SVG graphic: <svg width='36' height='30'> <defs> <linearGradient id="normal-gradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:rgb(81,82,84); stop-opacity:.4"/> <stop offset="100%" style="stop-color:rgb(81,82,84); stop-opacity:1"/> </linearGradient> <linearGradient id="rollover-gradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:rgb(0,105,23); stop-opacity:.5"/> <stop offset="100%" style="stop-color:rgb(0,105,23);