Questions tagged [rgba]

RGBA stands for Red-Green-Blue-Alpha and specifies a color using four values which represent the amount of red, green, blue and alpha (opacity) in the color.

493 questions
235
votes
5 answers

Sass - Converting Hex to RGBa for background opacity

I have the following Sass mixin, which is a half complete modification of an RGBa example: @mixin background-opacity($color, $opacity: .3) { background: rgb(200, 54, 54); /* The Fallback */ background: rgba(200, 54, 54, $opacity); } I have…
Rick Donohoe
  • 6,141
  • 6
  • 24
  • 38
218
votes
12 answers

CSS hexadecimal RGBA?

I know you can write ... background-color: #ff0000; ... if you want something that is red. And you can write ... background-color: rgba(255, 0, 0, 0.5); ... if you want something red and translucent. Is there any terse way of writing partially…
Li Haoyi
  • 13,576
  • 15
  • 69
  • 130
200
votes
7 answers

Convert RGB to RGBA over white

I have a hex color, e.g. #F4F8FB (or rgb(244, 248, 251)) that I want converted into an as-transparent-as-possible rgba color (when displayed over white). Make sense? I'm looking for an algorithm, or at least idea of an algorithm for how to do…
Mark Kahn
  • 81,115
  • 25
  • 161
  • 212
113
votes
7 answers

Convert RGBA PNG to RGB with PIL

I'm using PIL to convert a transparent PNG image uploaded with Django to a JPG file. The output looks broken. Source file Code Image.open(object.logo.path).save('/tmp/output.jpg',…
Danilo Bargen
  • 15,862
  • 15
  • 79
  • 111
112
votes
15 answers

CSS background opacity with rgba not working in IE 8

I am using this CSS for background opacity of a
: background: rgba(255, 255, 255, 0.3); It’s working fine in Firefox, but not in IE 8. How do I make it work?
Moon
  • 17,794
  • 55
  • 130
  • 193
90
votes
5 answers

Sass/Compass - Convert Hex, RGB, or Named Color to RGBA

This may be Compass 101, but has anyone written a mixin which sets the alpha value of a color? Ideally, I would like the mixin to take any form of color definition, and apply transparency: @include set-alpha( red, 0.5 ); //prints rgba(255,…
Pat Newell
  • 2,109
  • 1
  • 16
  • 23
54
votes
5 answers

Overlay a background-image with an rgba background-color

I have a div with a background-image. I want to overlay the background-image with an rgba color (rgba(0,0,0,0.1)) when the user hovers the div. I was wondering if there's a one-div solution (i.e. not with multiple divs, one for the image and one for…
user1544337
51
votes
8 answers

How to replicate PS multiply layer mode

Does anybody know of a good way to replicate Photoshop's multiply layer mode using either an image or CSS? I'm working on a project that has thumbnails that get a color overlay when you hover over them, but the designer used a layer set to multiply…
Andrew Philpott
  • 939
  • 1
  • 9
  • 11
51
votes
7 answers

CSS: lighten an element on hover

Assuming an element is at 100% saturation, opacity, etc... how can I have its background become slightly lighter when it is hovered? The use case is that I'm allowing a user to hover over any element on a page. I don't want to go around determining…
Don P
  • 49,839
  • 95
  • 259
  • 394
33
votes
4 answers

Convert RGBA to HEX

Given a css color value like: rgba(0, 0, 0, 0.86) How do I convert that to a RGB hex value that takes the alpha component into account, assuming a white background?
Michael Böckling
  • 6,286
  • 6
  • 46
  • 59
32
votes
5 answers

Color similarity/distance in RGBA color space

How to compute similarity between two colors in RGBA color space? (where the background color is unknown of course) I need to remap an RGBA image to a palette of RGBA colors by finding the best palette entry for each pixel in the image*. In the RGB…
Kornel
  • 91,239
  • 30
  • 200
  • 278
32
votes
3 answers

How to convert rgba to a transparency-adjusted-hex?

I'm wondering how to convert rgba into hex in a way that translates the visible rgba-color (including transparency) into a hex value. Say I have this: rgba(0,129,255,.4) Which is sort of a "light blue"... I would like to know if there is a way to…
frequent
  • 24,965
  • 53
  • 166
  • 316
25
votes
3 answers

CSS RGBA border / background alpha double

I'm working on a website that has a lot of transparency involved, and I thought I would try to build it entirely in RGBA and then do fallbacks for IE. I need a "facebox" style border effect, where the outer border is rounded and is less opaque than…
stockli
  • 508
  • 1
  • 4
  • 11
22
votes
2 answers

ValueError: Invalid RGBA argument: What is causing this error?

I am trying to create a 3D colored bar chart using ideas from: this stackoverflow post. First I create a 3D bar chart with the following code: import numpy as np import matplotlib.colors as colors import matplotlib.cm as cm import matplotlib.pyplot…
Inspired_Blue
  • 1,721
  • 3
  • 9
  • 17
1
2 3
32 33