asciibird/src/components/Colours.vue

76 lines
1.8 KiB
Vue
Raw Normal View History

2021-03-29 05:10:31 +00:00
<template>
2021-08-04 23:09:29 +00:00
<div>
2021-03-29 05:10:31 +00:00
<t-button
type="button"
:style="`background-color: ${mircColours[currentFg]} !important;`"
class="border-gray-200 w-12 h-12 text-2xl"
2021-03-29 05:10:31 +00:00
id="currentColourFg"
@click="$store.commit('changeIsUpdatingFg', true)"
>
2021-08-04 03:21:06 +00:00
FG
</t-button>
2021-03-29 05:10:31 +00:00
<t-button
type="button"
:style="`background-color: ${mircColours[currentBg]} !important;`"
class="border-gray-200 w-12 h-12 text-2xl ml-2"
2021-03-29 05:10:31 +00:00
id="currentColourBg"
@click="$store.commit('changeIsUpdatingBg', true)"
>
2021-08-04 03:21:06 +00:00
BG
</t-button>
2021-03-29 05:10:31 +00:00
<t-button
type="button"
class="bg-white absolute rounded-3xl"
style="margin-left: -62px; margin-top: 12px"
2021-03-29 05:10:31 +00:00
id="swapColour"
@click="swapColours()"
>
<font-awesome-icon :icon="['fas', 'sync']" />
2021-03-29 05:10:31 +00:00
</t-button>
2021-03-29 08:21:23 +00:00
<t-button
type="button"
:style="`background-color: ${mircColours[currentBg]} !important;color: ${mircColours[currentFg]};`"
class="border-gray-200 w-12 h-12 text-2xl ml-2"
2021-03-29 08:21:23 +00:00
id="currentChar"
@click="$store.commit('changeIsUpdatingChar', true)"
>
2021-08-04 23:09:29 +00:00
{{ toolbarState.selectedChar === " " ? "SP" : toolbarState.selectedChar }}
2021-08-04 03:21:06 +00:00
</t-button>
2021-08-04 23:09:29 +00:00
</div>
2021-03-29 05:10:31 +00:00
</template>
<script>
2021-08-04 23:09:29 +00:00
import { mircColours99 } from "../ascii";
2021-03-29 05:10:31 +00:00
export default {
2021-08-04 23:09:29 +00:00
name: "Colours",
2021-03-29 05:10:31 +00:00
data: () => ({}),
computed: {
mircColours() {
return mircColours99;
},
toolbarState() {
return this.$store.getters.toolbarState;
},
currentFg() {
return this.$store.getters.currentFg;
},
currentBg() {
return this.$store.getters.currentBg;
},
},
2021-03-29 05:10:31 +00:00
methods: {
swapColours() {
2021-08-04 03:21:06 +00:00
const bg = this.currentBg;
const fg = this.currentFg;
2021-03-29 05:10:31 +00:00
2021-08-04 23:09:29 +00:00
this.$store.commit("changeColourFg", bg);
this.$store.commit("changeColourBg", fg);
2021-03-29 05:10:31 +00:00
},
},
};
</script>