fix: Text colour is getting merged with the light background colour (#5773)

This commit is contained in:
Sivin Varghese 2022-11-02 05:52:00 +05:30 committed by GitHub
parent f2753df8df
commit e1190fd9bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 5 deletions

View file

@ -4,7 +4,11 @@
:key="action.uri" :key="action.uri"
class="action-button button" class="action-button button"
:href="action.uri" :href="action.uri"
:style="{ background: widgetColor, borderColor: widgetColor }" :style="{
background: widgetColor,
borderColor: widgetColor,
color: textColor,
}"
target="_blank" target="_blank"
rel="noopener nofollow noreferrer" rel="noopener nofollow noreferrer"
> >
@ -22,6 +26,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getContrastingTextColor } from '@chatwoot/utils';
export default { export default {
components: {}, components: {},
props: { props: {
@ -34,6 +39,9 @@ export default {
...mapGetters({ ...mapGetters({
widgetColor: 'appConfig/getWidgetColor', widgetColor: 'appConfig/getWidgetColor',
}), }),
textColor() {
return getContrastingTextColor(this.widgetColor);
},
isLink() { isLink() {
return this.action.type === 'link'; return this.action.type === 'link';
}, },

View file

@ -71,7 +71,11 @@
v-if="!submittedValues.length" v-if="!submittedValues.length"
class="button block" class="button block"
type="submit" type="submit"
:style="{ background: widgetColor, borderColor: widgetColor }" :style="{
background: widgetColor,
borderColor: widgetColor,
color: textColor,
}"
@click="onSubmitClick" @click="onSubmitClick"
> >
{{ buttonLabel || $t('COMPONENTS.FORM_BUBBLE.SUBMIT') }} {{ buttonLabel || $t('COMPONENTS.FORM_BUBBLE.SUBMIT') }}
@ -83,6 +87,7 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import darkModeMixin from 'widget/mixins/darkModeMixin.js'; import darkModeMixin from 'widget/mixins/darkModeMixin.js';
import { getContrastingTextColor } from '@chatwoot/utils';
export default { export default {
mixins: [darkModeMixin], mixins: [darkModeMixin],
@ -110,6 +115,9 @@ export default {
...mapGetters({ ...mapGetters({
widgetColor: 'appConfig/getWidgetColor', widgetColor: 'appConfig/getWidgetColor',
}), }),
textColor() {
return getContrastingTextColor(this.widgetColor);
},
inputColor() { inputColor() {
return `${this.$dm('bg-white', 'dark:bg-slate-600')} return `${this.$dm('bg-white', 'dark:bg-slate-600')}
${this.$dm('text-black-900', 'dark:text-slate-50')}`; ${this.$dm('text-black-900', 'dark:text-slate-50')}`;

View file

@ -32,7 +32,11 @@
<button <button
class="button small" class="button small"
:disabled="isButtonDisabled" :disabled="isButtonDisabled"
:style="{ background: widgetColor, borderColor: widgetColor }" :style="{
background: widgetColor,
borderColor: widgetColor,
color: textColor,
}"
> >
<spinner v-if="isUpdating && feedback" /> <spinner v-if="isUpdating && feedback" />
<fluent-icon v-else icon="chevron-right" /> <fluent-icon v-else icon="chevron-right" />
@ -47,6 +51,7 @@ import Spinner from 'shared/components/Spinner';
import { CSAT_RATINGS } from 'shared/constants/messages'; import { CSAT_RATINGS } from 'shared/constants/messages';
import FluentIcon from 'shared/components/FluentIcon/Index.vue'; import FluentIcon from 'shared/components/FluentIcon/Index.vue';
import darkModeMixin from 'widget/mixins/darkModeMixin'; import darkModeMixin from 'widget/mixins/darkModeMixin';
import { getContrastingTextColor } from '@chatwoot/utils';
export default { export default {
components: { components: {
@ -89,6 +94,9 @@ export default {
return `${this.$dm('bg-white', 'dark:bg-slate-600')} return `${this.$dm('bg-white', 'dark:bg-slate-600')}
${this.$dm('text-black-900', 'dark:text-slate-50')}`; ${this.$dm('text-black-900', 'dark:text-slate-50')}`;
}, },
textColor() {
return getContrastingTextColor(this.widgetColor);
},
title() { title() {
return this.isRatingSubmitted return this.isRatingSubmitted
? this.$t('CSAT.SUBMITTED_TITLE') ? this.$t('CSAT.SUBMITTED_TITLE')

View file

@ -2,12 +2,13 @@
<div <div
v-dompurify-html="formatMessage(message, false)" v-dompurify-html="formatMessage(message, false)"
class="chat-bubble user" class="chat-bubble user"
:style="{ background: widgetColor }" :style="{ background: widgetColor, color: textColor }"
/> />
</template> </template>
<script> <script>
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin'; import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
import { getContrastingTextColor } from '@chatwoot/utils';
export default { export default {
name: 'UserMessageBubble', name: 'UserMessageBubble',
@ -26,6 +27,11 @@ export default {
default: '', default: '',
}, },
}, },
computed: {
textColor() {
return getContrastingTextColor(this.widgetColor);
},
},
}; };
</script> </script>

View file

@ -16,7 +16,11 @@
<button <button
class="button small" class="button small"
:disabled="$v.email.$invalid" :disabled="$v.email.$invalid"
:style="{ background: widgetColor, borderColor: widgetColor }" :style="{
background: widgetColor,
borderColor: widgetColor,
color: textColor,
}"
> >
<fluent-icon v-if="!isUpdating" icon="chevron-right" /> <fluent-icon v-if="!isUpdating" icon="chevron-right" />
<spinner v-else class="mx-2" /> <spinner v-else class="mx-2" />
@ -28,6 +32,7 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { required, email } from 'vuelidate/lib/validators'; import { required, email } from 'vuelidate/lib/validators';
import { getContrastingTextColor } from '@chatwoot/utils';
import FluentIcon from 'shared/components/FluentIcon/Index.vue'; import FluentIcon from 'shared/components/FluentIcon/Index.vue';
import Spinner from 'shared/components/Spinner'; import Spinner from 'shared/components/Spinner';
@ -59,6 +64,9 @@ export default {
...mapGetters({ ...mapGetters({
widgetColor: 'appConfig/getWidgetColor', widgetColor: 'appConfig/getWidgetColor',
}), }),
textColor() {
return getContrastingTextColor(this.widgetColor);
},
hasSubmitted() { hasSubmitted() {
return ( return (
this.messageContentAttributes && this.messageContentAttributes &&