Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8468031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:49:03+00:00 2026-06-10T15:49:03+00:00

Say I have a background color with a ribbon running over it in another

  • 0

Say I have a background color with a “ribbon” running over it in another solid color. Now, I want the ribbon to be partially transparent to let some details blend through, but still keep the ribbon the “same color” over the background.

Is there a way to (easily) determine, for a given opacity/alpha < 100% of the ribbon color, what RGB values it should have to be identical to its color with 100% opacity over the background?

Here’s a picture. Background is rgb(72, 28, 97), ribbon rgb(45, 34, 70). I want a rgba(r, g, b, a) for the ribbon so that it appears identical to this solid color.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:49:05+00:00Added an answer on June 10, 2026 at 3:49 pm

    Color blending is just a linear interpolation per channel, right? So the math is pretty simple. If you have RGBA1 over RGB2, the effective visual result RGB3 will be:

    r3 = r2 + (r1-r2)*a1
    g3 = g2 + (g1-g2)*a1
    b3 = b2 + (b1-b2)*a1
    

    …where the alpha channel is from 0.0 to 1.0.

    Sanity check: if the alpha is 0, is RGB3 the same as RGB2? Yes. If the alpha is 1, is RGB3 the same as RGB1? Yes.

    If you locked down only the background color and final color, there are a large number of RGBA colors (infinite, in floating-point space) that could satisfy the requirements. So you have to pick either the color of the bar or the opacity level you want, and find out the value of the other.

    Picking the Color Based on Alpha

    If you know RGB3 (the final desired color), RGB2 (the background color), and A1 (how much opacity you want), and you are just looking for RGB1, then we can re-arrange the equations thusly:

    r1 = (r3 - r2 + r2*a1)/a1
    g1 = (g3 - g2 + g2*a1)/a1
    b1 = (b3 - b2 + b2*a1)/a1
    

    There are some color combinations which are theoretically possible, but impossible given the standard RGBA range. For example, if the background is pure black, the desired perceived color is pure white, and the desired alpha is 1%, then you would need:

    r1 = g1 = b1 = 255/0.01 = 25500
    

    …a super-bright white 100× brighter than any available.

    Picking the Alpha Based on Colors

    If you know RGB3 (the final desired color), RGB2 (the background color), and RGB1 (the color you have that you want to vary the opacity of), and you are just looking for A1, then we can re-arrange the equations thusly:

    a1 = (r3-r2) / (r1-r2)
    a1 = (g3-g2) / (g1-g2)
    a1 = (b3-b2) / (b1-b2)
    

    If these give different values, then you can’t make it match exactly, but you can average the alphas to get as close as possible. For example, there’s no opacity in the world that will let you put green over red to get blue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say that I have some <TR style = background-color : red ;> and
Let's say I have a header: header { background-color: $main-background-color; height: 86px; #headerContent {
Let's say i have 15 processes/daemons running in the background. let's say one of
Let's say I have a style sheet dt{ width=15%; } dt x{ background-color:red; ????
Let's say I have this $(.a).animate( {left:100%}, {duration:50000, complete:function(){ $(.a).css(background-color,black); }} ); $(.b).mouseover(function(){ $(.a).stop();
Let's say you have a website where the body's background color is red and
Say I have a class named testThing: .testThing { background-color:#000000; float:left; height:50px; width:50px; }
Say for example I have the following styles: #HorizNav ul li a.active:link { background-color:
Let's say I have a situation in Silverlight where there is a background thread
let's say I have this set of HTML-markup and CSS #CSS .inputhelp_text { background:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.