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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:58:24+00:00 2026-05-27T21:58:24+00:00

in a project I’m making I’m using numerous color codes. the point is not

  • 0

in a project I’m making I’m using numerous color codes.
the point is not for them to be Beautiful, just differents.(I also want to be able to constantly have the same colors code for the same fields on refresh (no Random color generators))
I was thinking about taking the name of the fields and turn them to Hex color.
Is there a pre-defined function for this?

Exemple :

$string = "Blablabla";
$colorCode = toColorCode($string);

function toColorCode($initial){
    /*MAGIC MADNESS*/
    return array("R"=>XXX,"G"=>XXX,"B"=>XXX);
}

FORGOT TO MENTION : it’s important that the values are Numbers only.

  • 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-05-27T21:58:25+00:00Added an answer on May 27, 2026 at 9:58 pm

    As far as I can understand, you want to generate a fairly unique color code for a string.

    The easies way is to call a checksum function on the string, for example MD5:

    function toColorCode($initial){
      $checksum = md5($initial);
      return array(
        "R" => hexdec(substr($checksum, 0, 2)),
        "G" => hexdec(substr($checksum, 2, 2)),
        "B" => hexdec(substr($checksum, 4, 2))
      );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My project is currently using a svn repository which gains several hundred new revisions
Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on
project: Using VB.NET to build a winforms database interface and work-automation app. I am
project: Using VB.NET to build a winforms database interface and work-automation app. I am
Project (id) Permission (project_id, user_id) When user's create a project, I want to ensure
Our project uses XJC to generate Java classes from an XSD. I'm using JAVA
My project has some references. One of them has no path. I can't view
Project Euler #101 I just started learning Numpy and it so far looks pretty
Project#1 has some interfaces and classes that project#2 references. Now I want to use
The project my team has been working on has reached a point where we

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.