rgba

Color similarity/distance in RGBA color space

岁酱吖の 提交于 2019-11-28 17:08:54
问题 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 color space the most similar color can be assumed to be the one with the smallest euclidean distance. However, this approach doesn't work in RGBA, e.g., Euclidean distance from rgba(0,0,0,0) to rgba(0,0,0,50%) is smaller than to rgba(100%,100%,100%

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

时光总嘲笑我的痴心妄想 提交于 2019-11-28 16:36:56
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, 0, 0, 0.5); @include set-alpha( #ff0000, 0.5 ); //prints rgba(255, 0, 0, 0.5); @include set-alpha( rgb(255,0,0), 0.5 ); //prints rgba(255, 0, 0, 0.5); maxbeatty Use the rgba function built into Sass Sets the opacity of a color. Examples: rgba(#102030, 0.5) => rgba(16, 32, 48, 0.5) rgba(blue, 0.2) => rgba(0, 0, 255, 0.2) Parameters: (Color) color (Number)

White balance (Color Suppression) Formula?

微笑、不失礼 提交于 2019-11-28 14:12:54
I need help with a little bit of color math.(RGBA) I'm trying to reduce the amount of green on a character, without actually affecting the green background. Green screen for visual effects. So here is what I have: I have a guy on green screen. Using the expression: g>(r+b)/2 ? (r+b)/2:g Expression says if the green color value is greater than the sum of red and blue divided by 2, then it green will be set to that sum. Running that expression will give me the second image. You can see that the green is removed perfectly from the guy, which I want, but it also takes the green from the background

linear-gradient to transparent bug in latest safari?

走远了吗. 提交于 2019-11-28 12:40:51
I'm applying a basic linear-gradient like this: background-image: linear-gradient(to top, red, rgba(0,0,0,0)); this behaves as it's supposed to everywhere except in safari where the transparent is rendered as a blackish/greyish color: here's chrome (how it is supposed to be): and here's safari I've tried prefixing it with -webkit- , changing the rgba to rgba(0,0,0,0.001) but it never goes to solid transparent. is this a bug? is there a way to fix this? here's a fiddle https://jsfiddle.net/2Lrp3sv1/2/ This has to do with the way browsers render transparent . For most browsers, transparent ===

How to extract r, g, b, a values from CSS color?

天涯浪子 提交于 2019-11-28 11:57:31
What would be the easiest way to transform $('#my_element').css('backgroundColor') to object like this: { r: red_value, g: green_value, b: blue_value, a: alpha_value } ? var c = $('body').css('background-color'); var rgb = c.replace(/^(rgb|rgba)\(/,'').replace(/\)$/,'').replace(/\s/g,'').split(','); for(var i in rgb) { console.log(rgb[i]); } Try it here http://jsbin.com/uhawa4 Edit : var c = $('body').css('background-color'); var rgb = c.replace(/^rgba?\(|\s+|\)$/g,'').split(','); for(var i in rgb) { console.log(rgb[i]); } or even simpler way, just aiming at numbers var c = 'rgba(60,4,2,6)';

CSS rgba transparency bug in Chrome?

百般思念 提交于 2019-11-28 07:22:01
问题 Just placing a DIV with white background and any opacity value: background-color: rgba(255, 255, 255, .5); over a white (255x3) background. Actually DIV's background will be 254/254/254. This happen only in Chrome. FF/IE/Opera/Safari is ok. Bug? 回答1: This looks like a bug! I can confirm this misbehaviour. Got it also by using background: rgba(255,255,255,0.1) . More weird: the calculated style says background-color: rgba(255, 255, 255, 0.0980392) It is hard to see on cheaper displays using TN

Fast Converting RGBA to ARGB

纵饮孤独 提交于 2019-11-28 05:41:25
问题 I am trying to convert a rgba buffer into argb, is there any way to improve the next algorithm, or any other faster way to perform such operation? Taking into account that the alpha value is not important once in the argb buffer, and should always end up as 0xFF. int y, x, pixel; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = rgbaBuffer[y * width + x]; argbBuffer[(height - y - 1) * width + x] = (pixel & 0xff00ff00) | ((pixel << 16) & 0x00ff0000) | ((pixel >> 16) & 0xff);

Cross browser rgba transparent background while keeping content (text & images) non-transparent

帅比萌擦擦* 提交于 2019-11-28 05:32:35
I want to get rgba backgrounds working with all browsers. I did some searching and found out that generally there are three types of browsers out there: 1) Browsers that support rgba. 2) Internet Explorer that supports rgba via bizarre '-ms-filter' thing. 3) Browsers that do not support rgba, but I could use base64 png images with 'data URI scheme'. (Even when browser does not support URI scheme, according to this it still could be done.) I have no problems with rgba supporting browsers, and I can get it working with IE, but problem is that I have no idea how to generate client side base64 png

Determine RGBA colour received by combining two colours

泄露秘密 提交于 2019-11-28 00:00:58
I have two colours defined as RGBA (in my specific examples, one of the set is [white with alpha 0.85] and [57, 40, 28 with alpha 0.25]. The second colour is drawn over the first one (i.e. white with alpha is the background and the second colour is used for drawing). How can I figure out what the RGBA colour of the combination is going to be? I need to do this one-off - so any tools is fine (e.g. I'm happy to draw something in photoshop and see what comes out). I have several sets to combine, but not too many. Any pointers? Thanks. When using Painter's algorithm most color compositing is done

ChartJS canvas not displaying rgba colors in IE, Safari and Firefox

纵然是瞬间 提交于 2019-11-27 23:46:16
问题 Im using ChartJS to display some data but it's not rendering the canvas element correctly in IE, Firefox and Safari. My guess is that the background color property lacks any of the used prefixes for the other browser since it works fine in Chrome. Anyone else had this issue? Chrome : Firefox, Safari and IE: The code: window.onload = function() { var ctx = document.getElementById("canvas"); var myChart = new Chart(ctx, { type: 'line', data: { labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun",