Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów
[JS] Color Picker - rgb - Wersja do druku

+- Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów (https://www.webmastertalk.pl)
+-- Dział: Technologie internetowe - tworzenie stron WWW (https://www.webmastertalk.pl/forum-technologie-internetowe-tworzenie-stron-www)
+--- Dział: xHTML, CSS, JavaScript (https://www.webmastertalk.pl/forum-xhtml-css-javascript)
+--- Wątek: [JS] Color Picker - rgb (/thread-js-color-picker-rgb)



[JS] Color Picker - rgb - piottro1 - 01-11-2011




RE: [JS] Color Picker - rgb - piottro1 - 01-11-2011

Już sobie poradziłem.

W kodzie szablonu należy zmienić to:
Kod PHP:
document.getElementById('red').value this.color.rgb[0]*100 '%';
        
document.getElementById('grn').value this.color.rgb[1]*100 '%';
        
document.getElementById('blu').value this.color.rgb[2]*100 '%'

na to:

Kod PHP:
document.getElementById('red').value Math.round(this.color.rgb[0]*250);
        
document.getElementById('grn').value Math.round(this.color.rgb[1]*250);
        
document.getElementById('blu').value Math.round(this.color.rgb[2]*250); 

Teraz (dla koloru #4AE632 ) zamiast odczytu:

Kod PHP:
R29.01960784313726%
G90.19607843137256%
B19.607843137254903

mam:
Kod PHP:
R73
G
225
B
49 

Zamiast parametru "100" użyłem "250".