S
S
Sergey Savostin2015-02-10 15:02:29
Programming
Sergey Savostin, 2015-02-10 15:02:29

How to convert number to color?

The question sounds strange, I agree. The point is.
There are a certain number of blocks on the page. Each is assigned a certain number (ID, has nothing to do with the DOM). Several blocks can have the same ID. It is required to assign a color to each group of blocks with the same ID. It is necessary that the color be preserved, i.e. was tied to this ID.
Neither the ID (it can be either 10 or 12341532), nor their number (well, let it be no more than 100) is not known in advance.
Those. we need a unique conversion formula, like md5.
It is visually acceptable for blocks with similar but not equal IDs to be approximately the same color.
Any ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kalinin, 2015-02-10
@kal1sha

Вот например https://jsfiddle.net/kal1sha/Ltn9urmd/4/
вместо ID поставите свое число и все.

M
mayorovp, 2015-02-10
@mayorovp

Используйте любую контрольную сумму - тот же md5 или crc32

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question