From 30ca39eaaae273574d57dce6a13e60cdbbb5097f Mon Sep 17 00:00:00 2001
From: 2547techno <109011672+2547techno@users.noreply.github.com>
Date: Sun, 20 Aug 2023 21:25:17 -0400
Subject: [PATCH] Alternating background colour (#813)
---
CHANGELOG-nightly.md | 1 +
src/app/settings/SettingsNode.vue | 2 ++
src/app/settings/control/FormColor.vue | 27 +++++++++++++++++++
src/site/twitch.tv/modules/chat/ChatList.vue | 2 +-
.../twitch.tv/modules/chat/ChatModule.vue | 10 +++++++
src/types/app.d.ts | 12 ++++++++-
6 files changed, 52 insertions(+), 2 deletions(-)
create mode 100644 src/app/settings/control/FormColor.vue
diff --git a/CHANGELOG-nightly.md b/CHANGELOG-nightly.md
index 7912c3b97..4f9f812d6 100644
--- a/CHANGELOG-nightly.md
+++ b/CHANGELOG-nightly.md
@@ -2,6 +2,7 @@
**The changes listed here are not assigned to an official release**.
+- Added an option to select alternating background color for chat messages
- Fixed an issue with tab auto-completion on Kick
- Fixed emote tile width in emote menu
diff --git a/src/app/settings/SettingsNode.vue b/src/app/settings/SettingsNode.vue
index 6e6c394c7..f27b6ce14 100644
--- a/src/app/settings/SettingsNode.vue
+++ b/src/app/settings/SettingsNode.vue
@@ -37,6 +37,7 @@ import { db } from "@/db/idb";
import { useConfig } from "@/composable/useSettings";
import CloseIcon from "@/assets/svg/icons/CloseIcon.vue";
import FormCheckbox from "@/app/settings/control/FormCheckbox.vue";
+import FormColor from "@/app/settings/control/FormColor.vue";
import FormDropdown from "@/app/settings/control/FormDropdown.vue";
import FormInput from "@/app/settings/control/FormInput.vue";
import FormSelect from "@/app/settings/control/FormSelect.vue";
@@ -74,6 +75,7 @@ const standard = {
DROPDOWN: FormDropdown,
CHECKBOX: FormCheckbox,
INPUT: FormInput,
+ COLOR: FormColor,
TOGGLE: FormToggle,
SLIDER: FormSlider,
CUSTOM: undefined,
diff --git a/src/app/settings/control/FormColor.vue b/src/app/settings/control/FormColor.vue
new file mode 100644
index 000000000..596efea12
--- /dev/null
+++ b/src/app/settings/control/FormColor.vue
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/site/twitch.tv/modules/chat/ChatList.vue b/src/site/twitch.tv/modules/chat/ChatList.vue
index 0eefd5339..7ca85930e 100644
--- a/src/site/twitch.tv/modules/chat/ChatList.vue
+++ b/src/site/twitch.tv/modules/chat/ChatList.vue
@@ -551,7 +551,7 @@ defineExpose({
.seventv-chat-list[alternating-background="true"] {
.seventv-message:nth-child(even) {
- background-color: hsla(0deg, 0%, 50%, 6%);
+ background-color: var(--seventv-chat-alternate-background-color);
}
}
diff --git a/src/site/twitch.tv/modules/chat/ChatModule.vue b/src/site/twitch.tv/modules/chat/ChatModule.vue
index b35b80038..3f37d019b 100644
--- a/src/site/twitch.tv/modules/chat/ChatModule.vue
+++ b/src/site/twitch.tv/modules/chat/ChatModule.vue
@@ -248,6 +248,16 @@ export const config = [
hint: "settings.chat_alternating_background.hint",
defaultValue: false,
}),
+ declareConfig("chat.alternating_background_color", "COLOR", {
+ path: ["Chat", "Style"],
+ label: "Alternating Background Color",
+ hint: "Configure the color of alternating background (~6% opacity)",
+ disabledIf: () => !useConfig("chat.alternating_background").value,
+ effect(v) {
+ document.body.style.setProperty("--seventv-chat-alternate-background-color", `${v}0f`);
+ },
+ defaultValue: "#808080",
+ }),
declareConfig("chat.padding", "DROPDOWN", {
path: ["Chat", "Style"],
label: "Padding Style",
diff --git a/src/types/app.d.ts b/src/types/app.d.ts
index 95aaede87..886537953 100644
--- a/src/types/app.d.ts
+++ b/src/types/app.d.ts
@@ -100,6 +100,7 @@ declare namespace SevenTV {
DROPDOWN: [string, T][];
CHECKBOX: never;
INPUT: string;
+ COLOR: string;
TOGGLE: {
left: string;
right: string;
@@ -124,7 +125,16 @@ declare namespace SevenTV {
type SettingType = boolean | number | string | object;
namespace SettingNode {
- type ComponentType = "SELECT" | "DROPDOWN" | "CHECKBOX" | "INPUT" | "TOGGLE" | "SLIDER" | "CUSTOM" | "NONE";
+ type ComponentType =
+ | "SELECT"
+ | "DROPDOWN"
+ | "CHECKBOX"
+ | "INPUT"
+ | "COLOR"
+ | "TOGGLE"
+ | "SLIDER"
+ | "CUSTOM"
+ | "NONE";
}
interface ActiveEmote {