Linked Questions

0 votes
0 answers
108 views

Javascript - getting RGB color from a string [duplicate]

In my application I have a chat service. And as with chat, there are many users with different nicks, and I would like to have each nick with different color. So, are there any javascript algorithms ...
ojek's user avatar
  • 9,976
617 votes
23 answers
392k views

Seeding the random number generator in Javascript

Is it possible to seed the random number generator (Math.random) in JavaScript?
weepy's user avatar
  • 6,691
331 votes
16 answers
156k views

Algorithm to randomly generate an aesthetically-pleasing color palette [closed]

I'm looking for a simple algorithm to generate a large number of random, aesthetically pleasing colors. So no crazy neon colors, colors reminiscent of feces, etc. I've found solutions to this ...
Brian Gianforcaro's user avatar
251 votes
20 answers
180k views

How to automatically generate N "distinct" colors?

I wrote the two methods below to automatically select N distinct colors. It works by defining a piecewise linear function on the RGB cube. The benefit of this is you can also get a progressive scale ...
job's user avatar
  • 9,193
97 votes
12 answers
86k views

Generate distinctly different RGB colors in graphs

When generating graphs and showing different sets of data it usually a good idea to difference the sets by color. So one line is red and the next is green and so on. The problem is then that when the ...
Riri's user avatar
  • 11.8k
42 votes
3 answers
42k views

How to generate random pastel (or brighter) color in Javascript?

Question: Is there is any way (in JS) to create a random color code using just bright colors, or pastel colors? I am building a simple website that gives a random quote when I click a button, and with ...
Zzeks's user avatar
  • 631
8 votes
5 answers
19k views

Compute hex color code for an arbitrary string

Heading Is there a way to map an arbitrary string to a HEX COLOR code. I tried to compute the HEX number for string using string hashcode. Now I need to convert this hex number to six digits which ...
tech20nn's user avatar
  • 729
14 votes
3 answers
4k views

"Simulate" a 32-bit integer overflow in JavaScript

JavaScript can handle the following Math just fine: var result = (20000000 * 48271) % 0x7FFFFFFF; But in some programming languages, that first int*int multiplication results in a value too large to ...
IQAndreas's user avatar
  • 8,360
1 vote
2 answers
1k views

Randomly changing colors of specified elements within one div or post

I have in mind a design idea where certain elements of a post will have the same random color values. Example: <post> <top border-top = random color> <h1 color = same random color> ...
user2676385's user avatar
1 vote
1 answer
1k views

how to show one random background color for each record in a html table

I am using angular version 8. In my application i have to show a random color for each record in html table. but when displaying the random color if i move the cursor in display page, for each ...
Srinivas Neelamraju's user avatar
2 votes
1 answer
109 views

Iterate through regex'd results and replace it separately

Short: I'm looking for something like jQuery's .each() function with regex. I've got a long text with some short strings in the format of <abcd1234>. The abcd1234 should be wrapped in a <...
sascha's user avatar
  • 4,690
0 votes
1 answer
120 views

assigning color from query result to div

I have this query which gets some data from a database including a color in hex format. What I'd like to do is assign the color to a div in my html page. _sQry = "SELECT TOP 101 dossier_id, ...
dennismuijs's user avatar
  • 1,215