Skip to content

Commit

Permalink
Fixed (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
partha120804 authored Jun 10, 2024
1 parent 923a5b6 commit 74db57a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/customTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ const defaultColors = {
}

function applyColors() {

while (gridContainer.firstChild) {
gridContainer.removeChild(gridContainer.firstChild);
}

initializeGrid();

const root = document.documentElement;

root.style.setProperty('--primary-color', document.getElementById('primary-color').value);
Expand All @@ -51,6 +58,8 @@ const defaultColors = {
ALIVE_COLOR = document.getElementById('alive-color').value;
DEAD_COLOR = document.getElementById('dead-color').value;

drawCells();

saveColors();
title.style.color = isDark(color1) ? '#ffffff' : '#000000';
}
Expand All @@ -65,6 +74,7 @@ const defaultColors = {
DEAD_COLOR = "#CADCFC";
loadColorInputs(); // Update the color pickers to reflect default values
document.getElementById('custom-colors-container').style.display = 'none'; //Hide the Container if reset to default
drawCells();
}


Expand Down Expand Up @@ -107,10 +117,12 @@ function isDark(color) {
slopeSlider.addEventListener('input', function() {
ALIVE_COLOR = document.getElementById('color1').value;
DEAD_COLOR = document.getElementById('color2').value;
drawCells();
});

// Event listener for the Apply Gradient button
document.getElementById('apply-gradient-btn').addEventListener('click', function() {
ALIVE_COLOR = document.getElementById('color1').value;
DEAD_COLOR = document.getElementById('color2').value;
drawCells();
});

0 comments on commit 74db57a

Please sign in to comment.