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

  • Home
  • SEARCH
  • 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 8003711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:43:31+00:00 2026-06-04T16:43:31+00:00

I have been searching for a method to convert my whole css stylesheet from

  • 0

I have been searching for a method to convert my whole css stylesheet from color values to their respective grayscale values – however I couldn’t find a good way (aside from opening Photoshop and doing it the hard way).

Is there a method to do this, and does anybody know if there a jQuery script that could do it?

Note: This is not a question about converting color images to grayscale images, this is about converting a complete stylesheet to grayscale.

  • 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-04T16:43:32+00:00Added an answer on June 4, 2026 at 4:43 pm

    Here’s a Javascript function that will take RGB values, and return desaturated RGB values.

    function desaturate(r, g, b) {
        var intensity = 0.3 * r + 0.59 * g + 0.11 * b;
        var k = 1;
        r = Math.floor(intensity * k + r * (1 - k));
        g = Math.floor(intensity * k + g * (1 - k));
        b = Math.floor(intensity * k + b * (1 - k));
        return [r, g, b];
    }
    

    And if you wanted to desaturate a specific element in one foul swoop, you could do something like:

    function rgb_to_string(r, g, b) {
        return 'rgb(' + r + ', ' + g + ', ' + b + ')';
    }
    
    function desaturate_element(selector) {
        var fg = $(selector).css('color').match(/\d+/g);
        var bg = $(selector).css('background-color').match(/\d+/g);
        $(selector).css('color', desaturate(fg[0], fg[1], fg[2]));
        $(selector).css('background-color', desaturate(bg[0], bg[1], bg[2]));
    }
    

    See this in action in this JSFiddle. Those desaturation multipliers come from this thread.

    One other thing, the k value is how much you want to desaturate by. 1 will desaturate completely, and 0 will not desaturate at all.

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

Sidebar

Related Questions

Have been searching how to convert a dictionary to a string. But the results
I have been searching stackoverflow for ways to marshal data back from a thread
I have been searching everywhere but I could not find an answer. I need
I have been searching around using Google but I can't find an answer to
I have been searching for a while for a simple right-click menu for a
I have been searching for days for a way to always display just one
I have been searching the internet wildly for an answer to this question. We
I have been searching for the past through days, trying to figure out how
I have been searching but unable to find a proper list. Can someone please
I have been searching the internet for days now and I was just wondering

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.