Answer the question
In order to leave comments, you need to log in
Who can help with the final touch in creating an html color generator?
The generator consists of two blocks. The first is the choice of the main color, it has a height of 255 pixels, and itself is a set of gradients, the user can choose any color. The colors on it change as follows. First the gradient is from #ff0000 to #ff00ff, then red goes down to 00, then green goes up, then blue goes down, and so on until all the options have been iterated. There are 6 options in total - the first block is divided into 6 parts. The second block is a square of 255*255 pixels. In the upper right corner, the color selected by the user on the first block, the upper left corner is white, the lower pixels are black.
I wrote a code to get the color code. one of the colors is determined simply by the vertical position of the second block pointer (I removed it from the code). ll - horizontal position of the pointer in the second block, lt - vertical. score_2 - in which part of the first block the pointer is located (Since we have broken the first block into 6 parts).
var color2 = 255 / (255 - ll);
var color2 = lt / color2;
var color2 = Math.round((255 - ll) - color2).toFixed(0);
var color3 = 255 / (255 - score_2);
var color3 = (255 - ll) / color3;
var color31 = 255 - Math.round(255 - score_2 - color3).toFixed(0);
var color3 = 255 / color31;
var color3 = lt / color3;
var color3 = Math.round(color31 - color3).toFixed(0);
var pt = 255 - h;
var pl1 = 255 - pt;
var pl = 255 / pl1;
var pl2 = pl1 - zero;
var pl = pl2 * pl;
var rt = (255 - pt) / nzero;
var rt = pt / rt;
var rt1 = nzero + rt;
var rt = pl / (255 - rt1);
var rt = (255 - pl) / rt;
var rt = Math.round(rt1 + rt).toFixed(0);
if(sh % 2 == 0){
var rt = 255 - rt;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question