color switching button

This commit is contained in:
Ali Gator 2022-12-16 10:16:50 +01:00
parent 2d57acd0a5
commit ae9275647f
1 changed files with 16 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<input
name="liveColor"
type="color"
@value="cellProperties.liveColor"
:value="cellProperties.liveColor"
@input="updateCellProperties"
/>
</div>
@ -19,6 +19,9 @@
@input="updateCellProperties"
/>
</div>
<div class="form-field">
<a name="switchColor" @click="switchColor">Switch Colors</a>
</div>
<div class="form-field">
<label>Cell size</label>
<input
@ -26,7 +29,7 @@
type="number"
min="1"
:value="cellProperties.size"
@input="updateCellProperties"
@click="updateCellProperties"
/>
</div>
</form>
@ -58,6 +61,17 @@
this.setBoardWidth();
this.setBoardHeight();
},
switchColor() {
[this.cellProperties["liveColor"], this.cellProperties["deadColor"]] = [
this.cellProperties["deadColor"],
this.cellProperties["liveColor"],
];
},
},
};
</script>
<style scoped>
a:hover {
cursor: pointer;
}
</style>