R
R
RodgerFox2016-03-13 00:25:54
JavaScript
RodgerFox, 2016-03-13 00:25:54

Magical recalculation of HEX codes, perhaps?

Is it possible to recalculate HEX codes in js?
prim there are 1 and 2 codes, the first at 0, the second at 100, and each number between these values ​​is the average of 1 and 2 HEX codes?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2016-03-14
@sergiks

I wrote you an example with a transition, where an intermediate value is considered along the channels R, G and B. Colors A and B must be specified strictly as 6-digit hexadecimal strings.
This option is easier to implement, but worse in quality - in my opinion, the average colors are plain and wrong.
Qualitatively, in a cool way, you need to translate colors into an HSL or HSB model, read an intermediate value in those channels, and convert it back to RGB for display.

R
RodgerFox, 2016-03-13
@RodgerFox

The options are interesting, but not the same. You need to make a smooth color change from color number one to color number two. Provided that color number one will be at "zero", and color two at "one hundred" percent. But we may not reach one hundred percent, stop at 60% (note) and how can we be here? How to implement in js?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question