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 9191939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:48:28+00:00 2026-06-17T20:48:28+00:00

this might be a tough question. I have a php function that returns a

  • 0

this might be a tough question.

I have a php function that returns a color value in rgba() with an argument $alpha.

function colorWheel($alpha) {

   "rgba(170, 135, 178, ".$alpha.")"
   …
}

So when calling …

.title { color: <?php echo colorWheel(.8); ?>; }

… I get rgba(170, 135, 178, .8);


The problem I have with this is that the color is “transparent” and shows “overlays”.

enter image description here

However what I really like to have is just 80% of the color value!
Without any transparent overlays.

The question is now how to solve this?

Any creative ideas how to do that? I don’t need to use rgba() it’s just the easiest thing that came to my mind. Is there a CSS way not to blend overlaying shapes that have an alpha value?

Or is there a php solution to calculate a the 80% version of rgb(170, 135, 178)?
It is important that this calculation works dynamically with the function because there are more colors in the function – this is a follow-up question to “How to return a color-value based a date and random?”!

Thank you in advance.

  • 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-17T20:48:29+00:00Added an answer on June 17, 2026 at 8:48 pm

    that should do it:

    function colorWheel($alpha) {
        $r = round(170 * $alpha);
        $g = round(135 * $alpha);
        $b = round(178 * $alpha);
        "rgba($r, $g, $b, 1)";
        …
    }
    

    well, that makes the color darker, if you want to make it lighter you have to put alpha to a value > 1, and also check if r,g or b goes over 255 and set it to 255 if it does

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

Sidebar

Related Questions

I know this question might sound a little bit crazy, but I tough that
I'm developing a php/MySQLi based site. I have a question about what might happen
I have a question about regexes in Java, though I think this might apply
I know this might ma a simple question, it must have been answered before
I have two tables: users and user_depts. Let's say (for this question) that users
This might seem like a very easy question for some of you folks, but
This might be a simple question but I've searched and searched and can't find
This might be a naive question. However, I am just trying to understand why
This might be a very basic question but it confuses me. Can two different
This might get a little confusing as I have tried everything to make this

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.