Skip to content

Commit

Permalink
update to legacy color panel (IE11)
Browse files Browse the repository at this point in the history
  • Loading branch information
viliusle committed Jun 26, 2017
1 parent 7de806a commit cd99065
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,13 @@ function GUI_CLASS() {
};

this.set_color = function (object) {
if (HELPER.chech_input_color_support('main_color') == true && object.id == 'main_color')
if (MAIN.use_OS_color_mode == true && object.id == 'main_color')
COLOR = object.value;
else
COLOR = HELPER.rgb2hex_all(object.style.backgroundColor);
COLOR_copy = COLOR;

if (HELPER.chech_input_color_support('main_color') == true)
if (MAIN.use_OS_color_mode == true)
document.getElementById("main_color").value = COLOR; //supported
else
document.getElementById("main_color_alt").style.backgroundColor = COLOR; //not supported
Expand Down Expand Up @@ -606,7 +606,7 @@ function GUI_CLASS() {
this.sync_colors = function () {
document.getElementById("color_hex").value = COLOR;

if (HELPER.chech_input_color_support('main_color') == true)
if (MAIN.use_OS_color_mode == true)
document.getElementById("main_color").value = COLOR; //supported
else
document.getElementById("main_color_alt").style.backgroundColor = COLOR; //not supported
Expand Down Expand Up @@ -695,7 +695,7 @@ function GUI_CLASS() {
}
var c = document.getElementById("c_all").getContext("2d").getImageData(mouse_x, mouse_y, 1, 1).data;
COLOR = "#" + ("000000" + HELPER.rgbToHex(c[0], c[1], c[2])).slice(-6);
this.sync_colors();
GUI.sync_colors();
COLOR_copy = COLOR;
document.getElementById("lum_ranger").value = 0;
};
Expand Down
9 changes: 8 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ document.onload = MAIN.init(true);
* @author ViliusL
*/
function MAIN_CLASS() {
this.use_OS_color_mode = true;

this.init = function (first_load) {
if (first_load === true) {
GUI.draw_helpers();
Expand Down Expand Up @@ -39,8 +41,13 @@ function MAIN_CLASS() {
GUI.show_action_attributes();

//detect color support
if (HELPER.chech_input_color_support('main_color') == true)
this.use_OS_color_mode = false;
if (HELPER.chech_input_color_support('main_color') == true){
this.use_OS_color_mode = true;
}
if (this.use_OS_color_mode == true){
document.getElementById("main_color").value = COLOR; //supported
}
else {
//not supported
document.getElementById("main_color").style.display = 'none';
Expand Down

0 comments on commit cd99065

Please sign in to comment.