gradient

Browser handling of CSS “transparent” in gradients

好久不见. 提交于 2019-12-01 03:17:46
问题 Although the CSS colors rgba(255,255,255,0) and rgba(0,0,0,0) are apparently the same, i.e. transparent , when being looked at as plain colors, they affect the intermediate colors in gradients: linear-gradient(left center, rgba(0,0,0,0), rgba(255,255,255,1)) This yields grey semitransparent tones between the two ends. Now my questions: Do browsers select the “right” color for transparent automatically or is it a fixed color (most likely “black transparent” or “white transparent”)? Is this

Java 3 Color Gradient

萝らか妹 提交于 2019-12-01 01:02:07
问题 I have a JPanel , and I would like to paint a gradient within it. I have the code below, but that only paints a 2 color gradient. I would like to add a 3rd but don't know how. What I want is to have the top left of the panel as white, top right red, and both bottom corners black. What would I have to do to achieve this, something that looks like this: package pocketshop.util; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import

Can't do custom UIButton in iOS6 with enabled storyboard autolayout

感情迁移 提交于 2019-12-01 00:43:30
I faced strange behavior. I'm using custom styled button which I setup in my controller: - (void)viewDidLoad { [super viewDidLoad]; [self.signOutButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.signOutButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; CAGradientLayer *btnGradient = [CAGradientLayer layer]; btnGradient.frame = self.signOutButton.bounds; btnGradient.colors = [NSArray arrayWithObjects: (id)[[UIColor colorWithRed:102.0f / 255.0f green:102.0f / 255.0f blue:102.0f / 255.0f alpha:1.0f] CGColor], (id)[[UIColor colorWithRed:51.0f

Creating a CSS linear gradient based on two points relative to a rectangle

本小妞迷上赌 提交于 2019-12-01 00:08:33
I am trying to recreate the gradient tool in Sketch. The tool in Sketch is using two points with different colors to define a gradient: I want the output to be in the form of a CSS linear gradient value. The way a CSS linear gradient is constructed is an angle and x number of color stops with a color and a percentage defined: https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient So I want to convert two points relative to the rectangle in which the gradient should be rendered to the CSS format (two parameters with the correct percentage). Any ideas on how to approach this problem?

Applying css3 gradients with jQuery

折月煮酒 提交于 2019-11-30 23:53:43
问题 Eventually, I wish to dynamically alter gradients based on different things, but how do I get jquery to apply a css3 gradient? //works $(element).css("background-image", "url(http://www.google.co.uk/images/logos/ps_logo2.png)"); //doesn't work $(element).css("background-image","-webkit-gradient(linear,left bottom,right bottom,color-stop(0.50, rgb(194,231,255)),color-stop(0.50, rgb(255,255,255))"); //doesn't work $(element).css("background-image","-moz-linear-gradient(left center,rgb(194,231

Gradient facecolor matplotlib bar plot

我的未来我决定 提交于 2019-11-30 22:51:08
How do I add a gradient facecolor to my bar plots? I want to know how to use simple one-color gradients to complex multicolor gradients. Here is some example code: import numpy as np import matplotlib.pyplot as plt plt.figure(figsize=(1,5)) plt.axis([0,1,-50,200]) plt.xticks([]) plt.yticks([-40,180]) plt.bar(left=0, width=1, bottom=-40, height=220, color='r') plt.subplots_adjust(left=0.4, right=0.8) plt.savefig("test.png") import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt # http://matplotlib.sourceforge.net/examples/api/colorbar_only.html fig=plt.figure(figsize=(1,5))

Android, Create gradient border?

…衆ロ難τιáo~ 提交于 2019-11-30 22:04:27
I know it's frustrating after all similar posts at stackoverflow. I've surfed a lot of posts but i really couldn't solve my problem. So please help! I want to set a gradient border via xml like the image: How can i achieve this? Milan Pansuriya Customized as per your design, create a drawable file: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="8px"> <layer-list> <item> <shape android:shape="rectangle"> <solid android:color="#08000000" /> <corners android:radius="4dp" /> <padding android:bottom="3px" android

Android drawable with background and gradient on the left

谁说我不能喝 提交于 2019-11-30 21:21:24
W would like to have a drawable which has background and gradient on the left that is about 10dp wide. Image of what I would like to achieve: Red gradient on the left Background on the rest How I can achieve that? I've tried layer-list with two shapes but with no luck. Item background: <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/background" /> <item android:drawable="@drawable/gradient" /> </layer-list> Background drawable: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android

Android's gradient drawables: poor quality of screenshots in Eclipse

◇◆丶佛笑我妖孽 提交于 2019-11-30 20:26:57
I'm using drawables like the following one for backgrounds with a gradient: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#ffffff" android:endColor="#cccccc" android:angle="-90" android:dither="true" /> </shape> This results in a banded gradient on the emulator, and when I take a screenshot of the emulator (using Eclipse), the result is even poorer: Why? And how to solve this problem? It is although I'm using android:dither="true" in the drawables' XML and setting this in the

Can't do custom UIButton in iOS6 with enabled storyboard autolayout

不羁岁月 提交于 2019-11-30 20:26:42
问题 I faced strange behavior. I'm using custom styled button which I setup in my controller: - (void)viewDidLoad { [super viewDidLoad]; [self.signOutButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.signOutButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; CAGradientLayer *btnGradient = [CAGradientLayer layer]; btnGradient.frame = self.signOutButton.bounds; btnGradient.colors = [NSArray arrayWithObjects: (id)[[UIColor colorWithRed:102.0f /